Octavian Rasnita wrote at Fri, 31 May 2002 11:01:38 +0200: > Hi all, > > I want to upload a binary file. I know how and the upload works fine. However, I >don't know how > many bytes is ok to read at a time. > > I've seen in most examples that 1024 bytes number is used like: > > while ($bytesread=read($filename,$buffer,1024)) { > > However, I found that when I try to upload a file from localhost to my computer, for >testing only, > the file uploads very slow if I use 1024. If I use a bigger value like 10240 or >102400 instead, > the upload goes faster. > > Why is it important to use only 1024, and what happends if I use a bigger value? The >file won't > upload if the connection is too slow? >
I think the 1024 is not very important. But most people don't upload files with some MB size. So it would be waste of space and time always to create a huge buffer. Generally 1024, 2048, 4096 is a good compromiss. (The size is most oriented on the block size of the hard disk). When 102400 works good for you, then it's the perfect value. Best Wishes, Janek -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]