How do I include the Content-MD5 header in a FineUploader Azure request?

I would like to use the Content-MD5 header for Azure delivery with a client-side generated MD5 hash of the uploaded files. How do I accomplish this task in FineUploader?

Target audience: Firefox, Chrome, Safari, Opera, and IE10 +.

From this answer , I understand it should be possible, but at least half of our clients will be running on very old (slow) computers. Is it possible to do this client-side MD5 hashing approach?

A somewhat related question: I also thought it would be wise to set a maximum file size to reduce the burden on the MD5 hashing algorithm. Maybe just below the Azure "chunking" limit? From a different perspective: can I turn off chunking?

+3


source to share


1 answer


Fine Uploader provides direct access to the underlying object File

or Blob

through an API methodgetFile(id)

. Once you have access to this, you can use FileReader

to read the file / blob bytes and generate a hash. To make hashing easier, consider using a JS library like SparkMD5 .

The best place to compute this hash is probably in the callback handler onSubmit

. Since the process of reading the file is asynchronous, you will have to return a promise in your handler, which is supported by Fine Uploader. After the hash has been calculated, resolve the promise and set the hash as a parameter for the file using the FinePackerPartes API Method .



Can chunking be disabled?

Yes, you can, but you will lose all the benefits of chunking, along with the resume function and efficient retries if the file download fails halfway through.

+3


source







All Articles