Re: [PATCH] Passthrough MD5/SHA1 calculation of uploaded files

From: Date: Wed, 04 Aug 2004 15:25:29 +0000
Subject: Re: [PATCH] Passthrough MD5/SHA1 calculation of uploaded files
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-11915@lists.php.net to get a copy of this message
David Santinoli <u235@libero.it> writes: > Hi, > I'm submitting a patch to perform "on the fly" MD5/SHA1 digest > calculation of a file uploaded via the HTTP POST method. Being > not uncommon for applications to require some digest of a freshly > uploaded file, doing the math directly in the buffer where the file is > being read can save some time. It's a nice feature to be able to compute the digest on the fly. However... > Digest calculation is triggered by setting the special input fields > COMPUTE_MD5 and/or COMPUTE_SHA1 to a non-zero value: > > <input type="hidden" name="COMPUTE_SHA1" value="1"> > > (note that these assignments must precede the > <input type="file" name=...> field, as in the MAX_FILE_SIZE case.) ... this seems like a somewhat kludgy method of specifying what you want done. Specifically, it seems kludgy to add a hidden input field with a specific name. (What if there are multiple type="file" input elements and only one of them is to have its digest computed?) A cleaner method *might* be (if you can get the information returned to you) to add an attribute to the input element, something like: <input type="file" digest="md5" ...> At least this keeps the request with the element to which it applies. It's still a bit kludgy in that it's adding a "digest" attribute. I suspect you'll have trouble getting that digest attribute returned to you by the browser, though. I'd be inclined to keep things simple and call the digest functions in the normal way rather than "extending" HTML syntax. I do like the concept, though... Hmmm... Derrell

« previous php.internals (#11915) next »