Syntactic Confectionery Delight | |
PerlMonks |
Check that a value has been assigned to a variable when uploading a photoby Milti (Beadle) |
on Jan 14, 2014 at 18:33 UTC ( [id://1070581]=perlquestion: print w/replies, xml ) | Need Help?? |
Milti has asked for the wisdom of the Perl Monks concerning the following question: I am using the form shown below to upload photos to a webserver via a cgi program. <html> <body> <FORM ENCTYPE="multipart/form-data" ACTION="http://www.diversitylink.com/cgi-bin/file-upload.pl" METHOD="POST">Please select a file to upload: <INPUT TYPE="FILE" NAME="photo" size="20"> Please enter your account ID: <input type="text" Name="AccountID" size="30"><INPUT TYPE="submit" NAME="Submit" VALUE=Submit Form"> I am using a cgi program that I got from a tutorial on the web which is unchanged except for the addition of "$AccountID". Here's the program:
The line "if ( !$filename )" seems to check the size of the uploaded file and apparently works well. However I have not been able to write an if statement that checks to see if the variable $filename actually contains any information. I've tried things such as if ($filename eq "") but the program ignores that statement when no file has been selected for uploading. Can someone tell me the correct way to check to see if the variable $filename is empty? Any assistance will be much appreciated!
Back to
Seekers of Perl Wisdom
|
|