On Wed, Aug 04, 2004 at 11:35:17AM -0400, Ilia Alshanetsky wrote:
> On August 4, 2004 11:16 am, Dave wrote:
> > I think his point was that the hash is calculated as the file is
> > being uploaded, which saves having to read the whole file a second
> > time after uploading is finished. For big files, and repetitious
> > uploading, this could probably save on the CPU cycles and I/O load a
> > bit.
Exactly.
> That is true, but to really validate the file you'd still want to
> check the data you have on disk, rather then what PHP supposedly saved
> to disk.
Actually, I don't see this as a way to validate uploaded files; rather,
I consider it an optimized replacement for the upload -> md5_file()
sequence.
> Adding hidden fields (that may conflict with the ones some people
> already use) also seems like a recipe for trouble.
I admit that's a good point, although I can't really see many possible
uses for a hidden field named COMPUTE_MD5 in a file upload form - I bet
those people would be glad to switch to the new facility. ;-)
The suggestion by Derrell Lipman - requesting the hash calculation
by adding an attribute to the INPUT element - has some merit, but I
don't know how viable this road is (in terms of functionalities already
present in the PHP core), and I'd also like to stick to "standard" HTML.
Cheers,
David
--
David Santinoli, Milano + <david@santinoli.com>
Independent Linux/Unix consultant + http://www.santinoli.com