I have had this problem before. Try to echo out $_FILES['imagefile']['tmp_name'] when the field is blank. Then you will know what to control for... If I recall correctly, the file name is "none" if there is no uploaded photo. Thus, it exists and that is why the program enters your if statement when you would think that it wouldn't.

Good luck,
Chris

From: "Bryan Brannigan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Subject: [PHP] Skipping Image Upload if Filename is blank
Date: Wed, 19 Feb 2003 20:44:32 -0500

I have a form for uploading images.  If the browse field is empty I would
like it to not process the following copy command, thus eliminating the
error message it displays.  I thought this would work.. but I have been
proven wrong.  Anyone have any insight?

**snip**
if ($_FILES['imagefile']['tmp_name']) {
	copy ($_FILES['imagefile']['tmp_name'],
"../images/".$_FILES['imagefile']['name']) or die ("Could not copy");
}
**snip**

Thanks,

Bryan


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to