image upload on linux fine, but errors on windows - please h

daithi <[email protected]>
Newsgroups gmane.comp.web.oscommerce.devel
Message-ID <64fe87ee848ede10fe7f6fc74964b72f@osCommerce-Forums>
This message was sent from: Development
http://forums.oscommerce.com/viewtopic.php?p=176404#176404
----------------------------------------------------------------

hi all,
i am using the following piece of code for user image uploads - it works fine here on my linux machines but for some reason it will only allow gifs to be uploaded on windows....

this is the last issue stopping me going live, so any help would be greatly appreciated.

//start image uploader

$uploaddir = DIR_FS_CATALOG . DIR_WS_IMAGES;
$abpath = "/home/daithik/www/sites/housing/images"; //Absolute path to where images are uploaded. No trailing slash
$sizelim = "yes"; //Do you want size limit, yes or no
$size = "400000"; //What do you want size limited to be if there is one
$number_of_uploads = 3;  //Number of uploads to occur



{ // Begin processing portion of script
//all image types to upload
$cert1 = "image/jpeg"; //Jpeg type 2
$cert2 = "image/gif"; //Gif type
$cert3 = "image/png"; //Png type
$cert4 = "image/jpg"; //Png type
$log = "";



for ($i=0; $i<$number_of_uploads; $i++) {
	//checks if file exists
	if ($img_name[$i] == "") {
$log .= "No file selected for upload $i<br>";
	}
	if ($img_name[$i] != "") {
			//checks if files to big
			if (($sizelim == "yes") && ($img_size[$i] > $size)) {

$error = true;
$entry_image_size_error = true;
$log .= "File $i was too big<br>";
}

else {
//Checks if file is an image
if (($img_type[$i] == $cert1) or ($img_type[$i] == $cert2) or ($img_type[$i] == $cert3) or ($img_type[$i] == $cert4)) {
@copy($img[$i], "$abpath/$prodID+$img_name[$i]") or $log .= "Couldn't copy image 1 to server<br>";
if (file_exists("$abpath/$img_name[$i]")) {
$log .= "File $i was uploaded<br>";

}
} else {
$error = true;
$entry_image_type_error = true;
$log .= "File $i is not an image<br>";
     }
    }
   }
  }
 }


//end of image uploader

then in the file drawing the form:

<td class="main">&nbsp;<?php echo ENTRY_PROPERTY_IMAGES; ?></td>
</tr>
<tr>
<td class="main">
<?php 
if ($entry_image_type_error == true) {
echo ENTRY_IMAGE_TYPE_ERROR;
}
?>
</td>
</tr>

<tr>
<td class="main">
<?php 
if ($entry_image_size_error == true) {
echo ENTRY_IMAGE_SIZE_ERROR;
}
?>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.