-1 it seems somewhat redundant given that this signature can be easily generated via a single function call, md5_file() or sha1_file().
Ilia
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.
I'd like to see an ini setting to disable this, though.
Dave
On August 4, 2004 10:56 am, David Santinoli wrote:
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.
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.)
The result is found in the special variables $_FILES[userfile]["md5"] and $_FILES[userfile]["sha1"]. These variables are only defined upon request of the corresponding digest.
The patch was produced against the current CVS version of rfc1867.c (PHP_5_0 branch, v1.160).
Cheers, David
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php