Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple file upload with md5 check before upload

I am building a webpage for which I need a multi-file upload implementation that can hash a file before uploading it to the server.

The idea is that users can upload files that may or may not exist on the server already. To save bandwidth I want to hash the file before uploading it to the server, send the hash via POST, and only proceed with upload if the server responds that it does not have a file with this hash.

Are there any free Flash-based implementations (I suppose that JavaScript won't be able to load the file and hash it) that may work for me?

like image 431
Rytis Avatar asked Nov 15 '10 20:11

Rytis


1 Answers

You can read files in Javascript, FileReader API in HTML5 will do the job for you.

Next, feed the base64 string into b64_md5() function provided by this library: http://pajhome.org.uk/crypt/md5/instructions.html

Note that it could be time consuming if the file is too big. You might also need WebWorkers to do the conculation background.

like image 143
timdream Avatar answered Sep 30 '22 11:09

timdream