Re: [PATCH] Passthrough MD5/SHA1 calculation of uploaded files
| From: | Ilia Alshanetsky | Date: | Wed, 04 Aug 2004 15:08:20 +0000 |
| Subject: | Re: [PATCH] Passthrough MD5/SHA1 calculation of uploaded files | ||
| References: | 1 | Groups: | php.internals php.internals |
| Request: | Send a blank email to internals+get-11912@lists.php.net to get a copy of this message | ||
-1 it seems somewhat redundant given that this signature can be easily
generated via a single function call, md5_file() or sha1_file().
Ilia
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