PHP Codeigniter上载失败,没有错误

PHP Codeigniter上载失败,没有错误,php,forms,codeigniter,file-upload,Php,Forms,Codeigniter,File Upload,我想用注册表上传一个文件。我使用了Codeigniter的文件上传库。但该文件不会上载到目标,并且不会出现任何错误。 这只是我代码的一部分(所有代码都非常庞大) 控制器(seeker_register.php): 视图(vseeker_register.php): 这是$This->upload->data()输出: 请参见当我扫描您的代码时,我意识到您无法查看错误 要查看错误是什么,您需要使用var\u dump()或print\r()php方法查看错误是什么 例如: var_dump($th

我想用注册表上传一个文件。我使用了Codeigniter的文件上传库。但该文件不会上载到目标,并且不会出现任何错误。 这只是我代码的一部分(所有代码都非常庞大)

控制器(seeker_register.php):

视图(vseeker_register.php):

这是$This->upload->data()输出:


请参见

当我扫描您的代码时,我意识到您无法查看错误

要查看错误是什么,您需要使用
var\u dump()
print\r()
php方法查看错误是什么

例如:

var_dump($this->upload->display_errors());
在当前代码中,您需要更改:

$this->upload->display_errors();
exit();
致:

您需要首先识别错误,然后才能提出解决方案


:)

检查您的文件夹的权限我正在XAMPP for Windows上测试代码,用户是管理员。我有写的权限。如果您能够打印错误
错误报告(-1),您将遇到问题;ini_设置(“显示错误”、“打开”)在你的页面标题处刚刚过了这一步,我无法理解你的代码中有哪些是OP没有的,非常感谢。。。我没提那件事。错误是:“您尝试上载的图像超出了最大高度或宽度。”我尝试使用较小的图像,但效果良好。。。
...
// Prepare Aks
$config = array(
    'upload_path' => './img/users',
    'allowed_types' => 'jpg|jpeg|JPG|JPEG',
    'max_size' => '200',
    'max_width' => '1024',
    'max_height' => '768');

$this->upload->initialize($config);
$this->upload->do_upload('Aks');

$this->upload->display_errors();
exit();
...
Array
(
    [file_name] => Clipboard-2.jpg
    [file_type] => image/jpeg
    [file_path] => D:/khayyamkar.ir/www/img/users/
    [full_path] => D:/khayyamkar.ir/www/img/users/Clipboard-2.jpg
    [raw_name] => Clipboard-2
    [orig_name] => 
    [client_name] => Clipboard-2.jpg
    [file_ext] => .jpg
    [file_size] => 156.42
    [is_image] => 1
    [image_width] => 
    [image_height] => 
    [image_type] => 
    [image_size_str] => 
)
public function register() {

    $config = array(
        'upload_path' => './img/user',
        'allowed_types' => 'jpg|jpeg|JPG|JPEG|png',
        'max_size' => '200',
        'max_width' => '1024',
        'max_height' => '768');

    $this->upload->initialize($config);

    // you need to make sure that the upload path is existing
    // and also check the folder permission to be rwxr-xr-x
    // if you installed in a server where permission is required
    // for you to create image inside the folder

    // create a folder img/user in the root directory of the project
    // where application or system located

    // this will check 
    if ($this->upload->do_upload('Aks')) {
        echo 'success'; die;
    } else {
        var_dump($this->upload->display_errors());die;
    }


}
var_dump($this->upload->display_errors());
$this->upload->display_errors();
exit();
var_dump($this->upload->display_errors());
exit();