Link to home
Start Free TrialLog in
Avatar of irene79
irene79

asked on

Uploading File

How can i check whether user did specify a file b4 clicking "Upload"? im not using any client-side scripting, so im using perl to check at the server end.

$ret = &ReadParse(\%cgi_data,\%cgi_cfn,\%cgi_ct,\%cgi_sfn);

this gave me a temp file everytime i click on upload .. even though the user did not specify any file to upload.

i also need to prompt user if the file they specify does not exist at all. Thanks!
Avatar of jsatterl
jsatterl

Your questions are a bit vague, but I will try to answer the best I can.

I am assuming that you are talking about using the FILE input form type.

Let's say you have the following html form input tag:
<input type=file name=upload_file>

In you perl script if you check for
the existense of the upload_file paramter, you can tell if any file name was entered.  You can also do a -s on the temp filename in an if statement to find out if the uploaded file has a size greater than zero.

That should cover both of your questions.
Avatar of irene79

ASKER

ermm can i have the exact code please?
ASKER CERTIFIED SOLUTION
Avatar of jsatterl
jsatterl

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial