RE: [PHP] Skipping Image Upload if Filename is blank

From: Date: Thu, 20 Feb 2003 04:04:00 +0000
Subject: RE: [PHP] Skipping Image Upload if Filename is blank
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-136306@lists.php.net to get a copy of this message
Chris.. you are 100% correct, that took care of it. Thanks for the help, Bryan -----Original Message----- From: Chris Cook [mailto:cjc1800@hotmail.com] Sent: Wednesday, February 19, 2003 10:44 PM To: bryanb@acadianetworks.com; php-general@lists.php.net Subject: Re: [PHP] Skipping Image Upload if Filename is blank 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#136306) next »