Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: optimization of browser upload

by domm (Chaplain)
on May 16, 2002 at 19:19 UTC ( [id://167088]=note: print w/replies, xml ) Need Help??


in reply to optimization of browser upload

except for the 1024. What is its purpose?

As vladb pointed out, this limits the amount of data read. If you upload a 3 GB file without using some value for the buffer size, (I think) all the 3 GB would be loaded into memory, thus probably crashing your server. By using the technique you mentioned, you only load 1024 byte into memory, write them to the filehandel, read the next 1024, and so on.

is there anyway of giving a progress report will a file is uploading - the status bar at the bottom of an IE4 window gives no reflexion of how much long the file will take to transfer.

There is Apache::UploadMeter which does this, but I never used it. I think it requires mod_perl.

--
#!/usr/bin/perl -w just another perl hacker
print+seek(DATA,$=*.3,@-)?~~<DATA>:$:__DATA__

Replies are listed 'Best First'.
Re: Re: optimization of browser upload
by samtregar (Abbot) on May 16, 2002 at 20:38 UTC
    As vladb pointed out, this limits the amount of data read. If you upload a 3 GB file without using some value for the buffer size, (I think) all the 3 GB would be loaded into memory, thus probably crashing your server.

    Incorrect. The third argument to read is indeed the buffer size, but not setting it will not result in all data being read at once. Instead, it will result in this error:

    Not enough arguments for read

    -sam

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://167088]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (9)
As of 2024-04-19 06:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found