I would recommend using the jQuery FileFive : https://github.com/JDBurnZ/jquery-filefive
Internet Explorer 10, Firefox and Chrome support HTML5 file objects, which allows you to read the file size, file name and mime type, as well as the actual contents of the file; the later of which is useful if you want to display thumbnails of selected images without loading them.
Working jsFiddle example: http://jsfiddle.net/URqBk/
Code example:
<!DOCTYPE html> <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script> <script type="text/javascript" src="https://raw.github.com/JDBurnZ/jquery-filefive/master/jquery.filefive-0.1.0-rc1.min.js"></script> <script type="text/javascript"> $(function() { $(document.body).on('change', 'input[type="file"]', function(event) { var $ = $.filefive(this); $.each($filefive.files(), function(offset, file) { var $img = file.image(); $('body').append($img); } }); }); </script> </head> <body> <form> <input type="file" name="myfile" /> </form> </body> </html>
source share