How to check the size of each files that are being uploaded

T

tower.grv

Hello.
I am developing cgi perl script for uploading files with uploading
progress bar.
Now i have script that do this good.
While uploading i must to know total size of the file that is being
uploaded.
It is not problem becouse there is global variable
$ENV{CONTENT_LENGTH} that contains the lenght of the attachment.

The problem is when 2 or more files are bieng uploaded.

How can i know the size of each file?
I use CGI->new(\&hook) method to catch file uploading process.
 
X

xhoster

Hello.
I am developing cgi perl script for uploading files with uploading
progress bar.
Now i have script that do this good.

How does it work? Does it use a separate frame for the monitoring?
While uploading i must to know total size of the file that is being
uploaded.
It is not problem becouse there is global variable
$ENV{CONTENT_LENGTH} that contains the lenght of the attachment.

The problem is when 2 or more files are bieng uploaded.

How can i know the size of each file?

Strictly on the server, you can't. At least not until each file is done
being sucked down by the server and the next "multipart/form-data" starts
arriving.

You might be able to craft some javascript running on the client side that
will check on the local file size and encoded it into the form submission.

But I don't see the point. As a user, I'd want to know when the upload is
likely to be done. What do I gain by knowing what each individual
component is doing?
I use CGI->new(\&hook) method to catch file uploading process.

Xho

--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
 
T

tower.grv

Partial solution is to use javascript to check file sizes before user click on
Send button. But be sure to warn users which have javascript disabled in
browser. It is very simple:

<body>
<noscript>
<div style="border: 2px solid red">You have not javascript enabled, please
enable it.</div>
</noscript>
--
I tried to get file size with javascrip but i found that it is
imposiblem. Browsers don't allow this operation.
Do you know how to do this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top