This documentation is for the old version. Go to the latest Upload Suite docs

ImageUploader.HashAlgorithm Property

Supported in: ActiveX , Java

Algorithm to generate a hash value for each file to upload to the server.

Syntax

Initialize

JavaScript
<script type="text/javascript" src="iuembed.js">  </script>
<script type="text/javascript">
var iu = new ImageUploaderWriter("ImageUploaderID", 610, 500);
//...other params...
iu.addParam("HashAlgorithm", "");
//...other params...
iu.writeHtml();
</script>

Get/Set Value in Runtime

JavaScript
getImageUploader("ImageUploaderID").setHashAlgorithm(value);
value = getImageUploader("ImageUploaderID").getHashAlgorithm();

Property Value

A string value which specifies what hash algorithm to use. If an empty string is specified, no hash value is calculated.

Possible values are listed in the table below.

Hash algorithm nameDescription
SHASHA hash algorithm.
MD2MD2 hash algorithm.
MD5MD5 hash algorithm.

You can specify several hash algorithms separated by semicolon.

Default value is "".

Remarks

To get hash value on the server side, you should extract POST field which is named in the following way: HashCodeXXX_N , where XXX is the string value specified in this property (algorithm name), and N is the index of the file in the request.

When hash value is added to the request, it is encoded with Base64 algorithm. So it is necessary to decode it back. Most server platforms already have facilities to work Base64 encoding, however if you have problems with it, refer RFC 3548.

Note

The hash is calculated only for the original file, not for the thumbnails (even if the source file is not uploaded).

If you specify several algorithms, several hash values will be sent (for each algorithm). E.g. if you specify a value MD5;SHA, you will get the following POST fields:

  • HashCodeMD5_1, HashCodeMD5_2, etc.
  • HashCodeSHA_1, HashCodeSHA_2, etc.
Note

Hash calculation is quite resource-intensive operation. That's why if you need not verify uploaded files on the server, it makes sense to disable this feature to make Image Uploader faster. To do it, just specify empty string in this property.

See Also

Manual