Reputation: 163
I have that error message when I upload an image
Warning: getimagesize(C:\xampp\tmp\phpA563.tmp): failed to open stream: No such file or directory in C:\xampp\htdocs\dzmarket\admin\controllers\c_banners.php on line 61
my code is
$file = $_FILES['image'];
$allowedExt = array('jpg', 'jpeg', 'png');
$uploadsDirectory = 'resources/uploads/banners/';
$maxSize = 4000000;
$upload = new Upload($file, $allowedExt, $uploadsDirectory, $maxSize);
$uploadFile = $upload->uploadFiles();
$fileNames = $upload->getFilesName();
$tmpname = $file['tmp_name'][0];
$fileSize = getimagesize($tmpname);
and the print_r($file) gives me that
Array ( [name] => Array ( [0] => 623211835.jpg ) [type] => Array ( [0] => image/jpeg ) [tmp_name] => Array ( [0] => C:\xampp\tmp\php9584.tmp ) [error] => Array ( [0] => 0 ) [size] => Array ( [0] => 605275 ) )
I called the tmp_name correctly and I don't know where is the problem
Upvotes: 2
Views: 4485
Reputation: 31
Call getimagesize() before you upload the file. For me, the $_FILES['image']['tmp_name'] was removed after I had uploaded the file.
Upvotes: 3