MD5 and EXIF calculation

MD5 and EXIF calculation on browser

Real Uploader can calculation the MD5 of the file before uploading it on server. To enable use the md5Calculate option and use the md5 callback for getting a notification when MD5 has been calculated. The callback function will give the calculated MD5 value. Very useful function that can be used to check the file integrity on server side. It is implemented using WebWorkers to avoid browser freeze since it reads all the file.
Real Upload can also read the EXIF information stored on JPEG images. The exif information can be useful to make different image validations before upload or to show GPS location information live.

MD5 example code

Select a file and wait for MD5 to be calculated

                        <div id="targetElement"></div>
    <script type="text/javascript">
        var uploader = new RealUploader("#targetElement", {
            md5Calculate: true,
            listeners: {
                md5Done: function(file, md5value) {
                    $('#md5val').append('The MD5 of file '+file.name+' is: ' + md5value + '<br>');
                }
            }
        });
    </script>
    
                    

Try here the result

EXIF example code

                        <div id="targetElement2"></div>
    <script type="text/javascript">
        var uploader = new RealUploader("#targetElement2", {
            exifRead: true,
            allowedExtensions: ['jpg'],
            listeners: {
                exifDone: function(file, exifData) {
                    var strPretty = "";
                    for (var a in exifData) {
                        if (exifData.hasOwnProperty(a)) {
                            if (typeof exifData[a] === "object") {
                                strPretty += a + " : [" +  exifData[a].length + " values]" + "\<br>";
                            } else {
                                strPretty += a + " : " + exifData[a] + "\<br>";
                            }
                        }
                    }
                    $('#exifval').append(strPretty);
                }
            }
        });
    </script>
    
                    

Try here the result

Select a jpeg file containing some exif data