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