Here is my form page
<?php
\test.php
print("
<form action=\"test2.php\" method=\"post\" ENCTYPE=\"multipart/form-data\">
<INPUT TYPE=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"750000\">
<input type=\"file\" size=\"60\" name=\"image\">
<input NAME=\"upload\" type=\"submit\" value=\"Upload New Logo\">
</form>");
?>
Here is the Handler
<?php
\test2.php
if(isset($upload)){
$filepath = "\tempimages";
$dirname = "$filepath";
mkdir($dirname,0777);
$uploadpath = "$dirname\$image_name";
$dest = "";
if ( ($image != 'none') && ($image != '' )) {
$imagesize = getimagesize($image);
switch ( $imagesize[2] ) {
case 0:
echo '<font> Image is unknown </font>';
break;
case 1:
echo '<font> Image is a GIF </font>';
$dest = $uploadpath.uniqid('img').'.gif';
break;
case 2:
echo '<font> Image is a JPG </font>';
$dest = $uploadpath.uniqid('img').'.jpg';
break;
case 3:
echo '<font> Image is a PNG </font>';
$dest = $uploadpath.uniqid('img').'.png';
break;
}
if ( $dest != '' ) {
if ( copy($image, $uploadpath) ) {
echo '<font>File successfully stored.</font><BR>';
unlink($image);
} else {
echo '<font>File could not be stored.<BR></font>';
}
}
} else {
echo '<font>File not supplied, or file too big.</font><BR>';
}}
?>
I have tried many other variations of the code using $HTML_POST_VAR, $_FILES, etc and it seams to keep comming back to something Ihave set wrong on my server but I don't know what it could be.
The code is working on a server running
Windows 2000 Advance Server
IIS 5.0
PHP 4.2.3
The cods is not working on my server running
Windows XP
IIS 5.1
PHP 4.3.0
Thanks again for the help.