Re: Detect file size BEFORE upload it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I know that part of the POST transaction with the client and web server involves sending the 'content-length'..  there's no way to tap into that before the file's uploaded though I guess.
(example of how to manually POST using Python at leastfound here: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/146306)


Failing that.. I think someone had mentioned Java, but here's a quick and dirty way to do it in Javascript (found on: https://lists.latech.edu/pipermail/javascript/2003-April/005190.html)


var myFile = new File("c:\temp\myfile.txt");
myFile.open("r");
alert('myFile length: ' + myFile.getLength());


Havn't tested it, but I'd rather use a tiny Javascript than a Java applet.


My apologies if I missed something in the thread, I kind of speed read through it and wasn't going to respond, but it was nagging at the back of my brain so I had to do a quick search or two.. hah

-TG

= = = Original message = = =

Hi,

I have been trying _several_ ways to control the size of the files that 
can be uploaded in a form.

The problem is that I was able to detect file size after complete file 
is transfered.

I need to detect file size before all file is transfered, in order to 
cancel it and preserve server resources.

Any ideas?

Thanks in advance
Ruben Rubio Rey


___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux