Home » Php » php – uploading files not given a temp name

php – uploading files not given a temp name

Posted by: admin July 12, 2020 Leave a comment

Questions:

I have a PHP script that handles uploaded files. It’s typically working fine, but I’m occasionally getting upload errors. when I check the $_FILES array, this is what I can see:

File that has failed:

Array ( [Filedata] => Array (
      [name] => cbj2_web.pdf 
      [type] => 
      [tmp_name] => 
      [error] => 1 
      [size] => 0 ) )

File that has worked:

Array ( [Filedata] => Array ( 
        [name] => tick.png 
        [type] => application/octet-stream 
        [tmp_name] => /tmp/phpL8oYLc 
        [error] => 0 
        [size] => 1108 ) )

I’m not sure what’s going wrong or how to even pinpoint it. This is the at the first step of processing the file, so I don’t have any code that’s doing anything with the file.

Any suggestions?

How to&Answers:

From http://php.net/manual/en/features.file-upload.errors.php:

Value: 1; The uploaded file exceeds the upload_max_filesize directive in php.ini.

So you need to edit your php.ini file to increase the upload_max_filesize value to a higher value.

Answer:

You’re getting an error of 1. This is UPLOAD_ERR_INI_SIZE.

From http://php.net/manual/en/features.file-upload.errors.php:

The uploaded file exceeds the upload_max_filesize directive in php.ini.