Reputation: 3
I have a form with works well (upload) for many image files and with diferente size.
But some images are not uploaded to the server.
Problem images have empty $_FILE[name][tmp_name] and $_FILE[name][error] == 8.
In the same time other images (which have a larger or smaller file size) uploading properly.
Have you any ideas?
Thanks.
print_r($_FILES) for normal image FILES:Array ( [img] => Array ( [name] => Array ( [0] => 1320600215_0_284da_78d5c77a_xl.jpg ) [type] => Array ( [0] => image/jpeg ) [tmp_name] => Array ( [0] => /var/www/test/data/mod-tmp/phpoqm4qR ) [error] => Array ( [0] => 0 ) [size] => Array ( [0] => 126867 ) ) ) print_r($_FILES) for problem image FILES:Array ( [img] => Array ( [name] => Array ( [0] => 94689121_1GPPZgCqPmI.jpg ) [type] => Array ( [0] => ) [tmp_name] => Array ( [0] => ) [error] => Array ( [0] => 8 ) [size] => Array ( [0] => 0 ) ) )
Upvotes: 0
Views: 2764
Reputation: 127
if (isset($_FILES['files']) && !empty($_FILES['files']))
{
date_default_timezone_set("asia/kolkata");
$image=date("YmdHis")."_".$_FILES['files']['name'];
move_uploaded_file($_FILES['files']
['tmp_name'],"uploads/business/".$image);
}
Upvotes: 0
Reputation: 244
Hi error code 8 means:
UPLOAD_ERR_EXTENSION
Value: 8; A PHP extension stopped the file upload. PHP does not provide a way to ascertain which extension caused the file upload to stop; examining the list of loaded extensions with phpinfo() may help. Introduced in PHP 5.2.0.
Things that may help:
check if your server has some extra security modules installed that may limit file uploading (eg.Suhosin gives a lot of these issues)
check if your max_upload_filesize and post_max_size params are properly set
try to check if this issue happens with some specific file (eg. big files, for some extensions or some filenames) or if it's completely random
Upvotes: 0