Jump to content

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/196076-error-uploadin-image-file/
Share on other sites

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.