Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Uploading files Need some advise reg. $ENV{'CONTENT_LENGTH'}

Status
Not open for further replies.

Tore

Technical User
May 18, 2001
29
NO
Hi..

I'm new to Perl.

But it look like some magic can be done using perl compared to PHP when uploading files.

I looked at the FAQ regarding uploading of files using CGI.pm module.

In the example from the FAQ there was only one text field to enter the file to be uploaded.

I added one text field so it now look like this:

<FORM METHOD="POST" ACTION="/cgi-bin/tbk-upload.cgi"; ENCTYPE="multipart/form-data">
<P>Enter or Browse to the file you would like to upload.<BR>
<INPUT TYPE="file" NAME="FILEID" VALUE="" SIZE=50 MAXLENGTH=80><BR>
<INPUT TYPE="file" NAME="FILEID2" VALUE="" SIZE=50 MAXLENGTH=80><BR>
<INPUT TYPE="submit" NAME="submit" VALUE="uploadMe"></FORM>

The question:

Using only one field and then
print "Upload total size: '" . $ENV{'CONTENT_LENGTH'} . "'<br>";

in the tbk-upload.cgi displayes the approx size for the file to be uploaded.

If I use two text fields and select two files to be uploaded in the form and submit it then
$ENV{'CONTENT_LENGTH'}
displays the approx size for both of the files to be uploaded....

Is there a way for me to get the filesize of both of the files individually before handling of the individual files starts?

Now it looks like $ENV{'CONTENT_LENGTH'}
returns the length of all that is to be sent from the browser, I would like to know the size of the selected files, individually.

Regards


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top