Uploading Images Filename


Thanks in advance for any assistance with a script that was working fine yesterday and seems to have fallen over for reasons I can’t get a fix on.

Script should allow me to upload images and save a copy in three widths.

Excerpt from script:

ShowProduct ($product_id);
$new_image_id=GetNewImageID ();
   if( isset($_POST['submit']) ) {
$image_count=ImageCount ($product_id, $Images_Unique_Ref);
   if ($image_count==0) {
      $image = new SimpleImage();
	InsertNewImageID ($new_image_id, $product_id, $Images_Unique_Ref);

Excerpt from class

class SimpleImage {
   var $image;
   var $image_type;
   function load($filename) {
      $image_info = getimagesize($filename);
      $this->image_type = $image_info[2];
      if( $this->image_type == IMAGETYPE_JPEG ) {
         $this->image = imagecreatefromjpeg($filename);
      } elseif( $this->image_type == IMAGETYPE_GIF ) {
         $this->image = imagecreatefromgif($filename);
      } elseif( $this->image_type == IMAGETYPE_PNG ) {
         $this->image = imagecreatefrompng($filename);

As I say, have had it working but now getting error messages. First is:

Warning: getimagesize() [function.getimagesize]: Filename cannot be empty in

There are other messages but I think the rest are all arising from this failure to get a filename to work on the uploaded file.

Any ideas would be gratefully received.

check $_FILES[‘uploaded_image’][‘error’] for errors.
And $_FILES array structure going to be different if more than 1 image were uploaded.
I’d suggest to do
in this case

Thanks Shrapnel,

Appreciate you taking the time. I’ve just done a bit of testing and it seems to be a problem with the size of the images I am using today. Yesterdays successful test run was on smaller sized images and have got it working by first reducing before uploading. Don’t know if the problem is a maximum size / width or filesize or why this would cause such problems.

just put this line in your code
and study output.
if there is anything in the [‘error’] field, manual can explain the code:
Hope it helps.