Re: Skipping Image Upload if Filename is blank

From: Date: Thu, 20 Feb 2003 03:43:56 +0000
Subject: Re: Skipping Image Upload if Filename is blank
Groups: php.general 
Request: Send a blank email to php-general+get-136303@lists.php.net to get a copy of this message
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" <bryanb@acadianetworks.com> To: <php-general@lists.php.net> 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

« previous php.general (#136303) next »