Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Uploading and finding size.

by Anonymous Monk
on Jun 16, 2002 at 04:29 UTC ( #174897=perlquestion: print w/replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

say I was uploading a file in perl, well how would I find the size of that file before uploading it, and I know there is way to do it with JUST the CGI module, can't you do it with lenth(), or something.

Replies are listed 'Best First'.
Re: Uploading and finding size.
by Zaxo (Archbishop) on Jun 16, 2002 at 06:06 UTC
    say I was uploading a file in perl, well how would I find the size of that file before uploading it

    That sounds like client side.

    JUST the CGI module, can't you do it with lenth(), or something.

    That sounds like server side.

    It sounds like you want to do a simple file upload in cgi. CGI covers that well. The clientside cruft sounds like you have to deal with inexperienced page designers. It may be a political problem to seperate the two.

    On serverside, you can set's upload limit, but you have no way (we all hope) of illegally cracking the clients file system to preview uploads.

    Update: ++rob_au, your remarks are right on the money.

    After Compline,

      I agree, it sounds like Anonymous Monk is looking for a solution that would best encompass both client-side and server-side routines - However, for basic upload size determination, the CONTENT_LENGTH environment variable can be used to find the size of the POST component of the multi-part request - This approach has merit where the server-side application may need to manipulate the uploaded file via a process where there are subsequent limits on file size. It should also be noted to that this is the same way by which imposes POST size restrictions as set by the $CGI::POST_MAX variable.

      An example as to how one can make use of the CONTENT_LENGTH environment variable to impose custom handling of over-size multi-part requests can be found here.


        worked, great, Thanks

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://174897]
Approved by ChemBoy
[james28909]: seems like a person cant even have a belief without hurting someones feelings. i never said my way is the only way. i just said i have pretty good scientific evidence, and then asked for opposing side to present evidence
[james28909]: was downvoted and left without a reply. go figure
[holli]: but then you DO give a fuck
[1nickt]: I don;t think beliefs should be down-voted, just behaviours.
[james28909]: im not quite how to explain it any better nick. you evolved from ignorance to intelligence. not the other way. the universe evolves from gas coulds and debris into planets stars and galaxies ect. it doesnt happen any other way. hence it has ....
[james28909]: some kind of logic behind it
[james28909]: and that is also anothe rpoint i made, i think it has to do with perception of the world around you. most people think of evolution on a human scale. why could life evolve on this planet? because this planet evolved in this solar system. and so on.
[holli]: here's something for you to watch, James. I think you will like it
[erix]: for the record: I have not downvoted anyone on that subthread that was my fault
[james28909]: there are all kinds of things that had to happen to let life come to be. but at the same time, life may not be the end goal IF there is any kind of end goal lol

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (14)
As of 2017-12-15 14:31 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (433 votes). Check out past polls.