-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Stephan Jennewein wrote:
> What I want to do is a upload progressbar with Ajax.
"Upload" it's a "specialized" HTTP POST request, transmitting MIME
objects ("multipart/form-data") from client to server. This data
consists of, _among others_, the bytes representing your "file".

These being said...

> My problem is that I need the size of file which you wants to upload
> to calculate the amount of time it will take to upload it.
If you want "an estimated time to complete the POST request", it's
easily doable by using your request hooks (HOOK_DATA and UPLOAD_HOOK) to
compare info with the designated request content length
($ENV{CONTENT_LENGTH}). This is the only accurate estimation you are
able to do _without_ processing the MIME data (which obviously it's
impossible to do, since that would mean all data has to already been
transfered, so it won't be a "progress-bar"). Even then, you still have
to keep in mind that there are cases (clients issues mostly) when
CONTENT_LENGTH is not set.

OTOH, if you need "file ETA" ("file" being an object comprised in that
POST request), you walk on thin ice as there is no perfect answer to
this one. There is no case where CONTENT_LENGTH == file_length, and no
universal estimation solution for determining the value of "delta_len"
in CONTENT_LENGTH - delta_len = file_length (again, _without_ parsing MIME).

So, in this case, your best guess is my best guess. You'll find lots of
"guessers" on the net (even some CPAN modules), take your pick.

> Is there a way without using CGI to get the [file] size ? 
I'd really wanna know what you had in mind with this question.

cheers
- --
Marius Feraru
-----BEGIN PGP SIGNATURE-----

iD8DBQFFHrtHtZHp/AYZiNkRAjMuAJsExXgqTudRR3nqCkw0d3Ccwv3z2wCcCm3K
uxidU+BPK9JQh3jAQtYeqoU=
=pROx
-----END PGP SIGNATURE-----

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to