Applet: | DownloadClient and UploadClient |
Description: | The MD5 hash is a 128-bit "fingerprint" of the file. JFile allows you to use a file's MD5 hash to to ensure the veracity of transferred files. Sending the MD5 Hash with an UploadIf SendMD5 is set to 1, JFile's UploadClient will send the MD5 hash of each file it uploads. JFile sends the MD5 hash as a 32 character string, in the HTTP header "X-MD5." Sending this fingerprint allows you to check the file to determine whether it was corrupted during transfer. Note that MD5 key generation, and the key comparison after upload, must be implemented on the server. SendMD5 is set to 0 by default. In very large uploads, generating an MD5 key for each file can take so long that the upload may fail. Enabling SendMD5 is not recommended for very large uploads. Checking the MD5 Hash Key of a DownloadIf SendMD5 is set to 1, JFile's DownloadClient will generate an MD5 hash key for each file downloaded, and compare the key to the key sent from the server in the header Content-MD5. Note that to compare keys, you must implement the creation and transfer of a file's MD5 hash on the server. If the MD5 hash key generated by the DownloadClient does not match the key sent from the server, JFile will return Error 305 FILE_VERIFICATION_ERROR. However, if SendMD5 is set to 1, and the MD5 header is not sent, JFile will not throw Error 305; therefore, it is safe to enable SendMD5 even when MD5 key generation may not be available on the server. SendMD5 is set to 0 by default. See also, CreateMD5DebugFile. |
Example: | <param name="SendMD5" value="1"> |