sorin1z Posted March 22, 2010 Share Posted March 22, 2010 Pr1dv0are in my admin's site when i try to introduce a new product category which contains the title, descriptions, a small image and a big image, after i introduce the datas in the form i get an error Eroare: Sorry, only uploaded files! fatal error: Call to undefined exif_imagetype() in .....(a certain file name with its position on the server) on line 70. This is what it writes in this file around line 70 function loadFromPOST($key) { $file=$_FILES[$key]['tmp_name']; if (!is_uploaded_file($file)) { $this->addError("Sorry, only uploaded files!"); return false; } if (!function_exists('imagecreatefromstring')) { $this->addError("Need GD, sorry!"); return false; } $mime=exif_imagetype($file); if (!$mime) { $this->addError("Image type not supported"); return false; } $data=file_get_contents($file); $ii=getimagesize($file); if (!$ii || !$ii[0] || !$ii[1]) { $this->addError("Failed retrieving image info!"); return false; } $this->setAttr('mime_type',image_type_to_mime_type($mime)); $this->setAttr('data',$data); $this->setAttr('latime',$ii[0]); $this->setAttr('inaltime',$ii[1]); $this->setAttr('nume',$_FILES[$key]['name']); return true; } that's all. i do not know how to fix it. the new category doesn't post. can anybody give me a clue? Quote Link to comment https://forums.phpfreaks.com/topic/196076-error-uploadin-image-file/ Share on other sites More sharing options...
PFMaBiSmAd Posted March 22, 2010 Share Posted March 22, 2010 The first error occurred because $_FILES[$key]['tmp_name'] was not an uploaded file. Since it is unlikely that you are trying to fake out your own code by putting files directly put into the tmp upload file location on the server, the error is probably occurring because $_FILES[$key]['tmp_name'] is not set due to an upload error. That would indicate that your code is not checking for any of the possible upload errors before it attempts to access any of the uploaded file information. Is your code in fact checking the ['error'] element of each possible uploaded file before reaching the code that you did post? The second error is because the exif_imagetype() function does not exist in your version of php. Since the code is checking and passing the test if the GD functions are present, that would indicate that your version of php is older than 4.3. The end of life of php4 was well over two years ago. It is time you planned upgrading to the latest php5 version. Quote Link to comment https://forums.phpfreaks.com/topic/196076-error-uploadin-image-file/#findComment-1029827 Share on other sites More sharing options...
sorin1z Posted March 26, 2010 Author Share Posted March 26, 2010 thanks for all the help. i fixed it. sims that the server wasn't having the exif extension activated Quote Link to comment https://forums.phpfreaks.com/topic/196076-error-uploadin-image-file/#findComment-1032230 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.