The form:
<form enctype="multipart/form-data" action="<?php echo
$_SERVER['PHP_SELF'] ?>" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="10000">
<fieldset>
<legend>Add Rider</legend>
<label for="rider_name">Name:</label>
<input type="text" name="rider_name" id="rider_name" size="30"
maxlength="30" /><br />
<label for="rider_license_cat">Lic. Cat.:</label>
<input type="text" name="rider_license_cat" id="rider_license_cat"
size="2" maxlength="1" /><br />
<label for="comments">Comments:</label>
<input type="text" name="comments" id="comments" size="30"
maxlength="30" /><br />
<label for="image_upload">Upload Image:</label>
<input name="image_upload" id="image_upload" type="file" /><br />
<p><input type="submit" name="action" value="Add Rider"></p>
</fieldset>
</form>
The code:
if (is_uploaded_file($_FILES['image_upload']['tmp_name'])) {
move_uploaded_file($_FILES['image_upload']['tmp_name'],
$upload_file_path);
echo "success";
} else {
echo "Possible file upload attack. Filename: " .
$_FILES['image_upload']['name'] . "<br />\n";
switch($_FILES['HTTP_POST_FILES']['userfile']['error']){
case 0: //no error; possible file attack!
echo "There was a problem with your upload.<br
/>\n";
break;
case 1: //uploaded file exceeds the upload_max_filesize
directive in php.ini
echo "The file you are trying to upload is too
big.<br />\n";
break;
case 2: //uploaded file exceeds the MAX_FILE_SIZE
directive that was specified in the html form
echo "The file you are trying to upload is too
big.<br />\n";
break;
case 3: //uploaded file was only partially uploaded
echo "The file you are trying upload was only
partially uploaded.<br />\n";
break;
case 4: //no file was uploaded
echo "You must select an image for upload.<br />\n";
break;
default: //a default error, just in case! :)
echo "There was a problem with your upload.<br
/>\n";
break;
}
}
}
No matter what I try this keeps falling through to the default switch.
--
Brian V Bonini <[EMAIL PROTECTED]>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php