Question : POST file to script

How does a browser upload a file? If this is the wrong area please let me know. But does anyone know the exact why a browser sends an upload POST to perl?

Answer : POST file to script

Good to hear that! Great that it works great :-)

One tiny detail to think of... the part where the code saves the uploaded file to the local file is a bit slow, especially on large files. It doesn't consume any CPU-power however, it just takes some time before the statement "print SAVE <$file>;" is executed. To resolve that problem (it's something you'll probably notice as soon as your project goes live, not in debug stadia) change the code to a read-line and a print line, like the save-lines in the above code of guadalupe:

while($bytesread=read($file,$data,1024)){
    #You might want to sum $bytesread to know the length of the saved file
    print SAVE $data;
}

Depending on the buffersize (here 1024) it should be lots faster :-) Actually I think that in my code, though it's much more concise, the buffersize is close to a byte or a word or so and I guess that's the main reason that saving the file takes so long.

About my points, you can reward me when you want to, just choose a comment you think fits best the answer to your question and choose "accept comment as answer".

I'm looking forward to downloading the ZIP-file. I'm quite curious by now!

Greetz,
Abel
Random Solutions  
 
programming4us programming4us