in reply to Re: Sending file data to a browser
in thread Sending file data to a browser

Thanks. I think I can adapt this. But why is the read 8192 bytes at a time? I've seen 1024 before, why 8192? Does it result in the same output, or is there a difference?

Replies are listed 'Best First'.
Re^3: Sending file data to a browser
by ikegami (Patriarch) on Dec 06, 2005 at 01:02 UTC
    Both numbers are arbitrary. 1024 Bytes is 1 KB. 8192 Bytes is 8 KB.
Re^3: Sending file data to a browser
by monarch (Priest) on Dec 06, 2005 at 01:08 UTC
    You can make the number of bytes read in a read to whatever size suits you. It's a balancing act between making system calls (expensive in time) vs how much data to extract at a time (expensive in memory). Anything will work, from one byte to a million (or even more), the last read will only partially fill the buffer anyway.

    Have a look at perldoc -f read for more details on the read function.

    On another note, it is interesting to see that Microsoft Internet Explorer for Windows XP refuses to allow one to download a file if the cached parameter is set on the server. Why this is so confuses the blazes out of me. It's not the only thing that Microsoft have $!@#ed up in the latest version of IE. Seriously, who are the complete $!#@heads that work for Microsoft?? Either dumb or seriously seriously selfish $!#@s.

      What is the header text for the nocache header? I'm using plain old print not $r. Thanks in advance