<head>
<title>Uploading...</title>
</head>
<body>
<h3>Uploading file...<br><br></h3>
<?
if ($userfile=="none")
{
echo "Problem: no file selected";
}
if ($userfile_size==0)
{
echo "Problem: uploaded file is zero length";
}
if ($userfile_type == "image/png")
{
echo "This is a .png file.";
}
if ($userfile_type == "image/bmp")
{
echo "This is a bitmap file.";
}
if ($userfile_type == "image/jpg")
{
echo "This is a jpeg file.";
}
if (!is_uploaded_file($userfile))
{
echo "Problem: file not uploaded";
}
$upfile = "/home/verlynia/www/toomanyprojects/".$userfile_name;
if ( !copy($userfile, $upfile))
{
echo "Problem: could not copy file to directory. Please make sure it's name is unique.";
}
echo '<img src="$userfile">';
?>
</body>
The form works fine, I can upload text files with no errors and it works great, but when I try to upload a bitmap it breaks. Here's the output when I try:
Problem: no file selected
Problem: uploaded file is zero length
This is a bitmap file.
Problem: file not uploaded
Warning: Unable to open 'none' for reading: No such file or directory in /www/verlynia/toomanyprojects/upload.php on line 41
Problem: could not copy file to directory. Please make sure it's name is unique
In the original code, I had exit; commands within the brackets of all of the error codes. I took them out for error checking. Anyone have any ideas why this isn't working?
It's not working for .png's or jpg's either, but it looks like any non-graphic file will upload just fine.
Thanks for your help in advance.