When a user is uploading an image, is there a way I can load the image client side and show it to them first, before uploading it to the server? Preferably using javascript/jquery only, but using flash would be acceptable too.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It is possible with the new
FileReaderinterface defined in HTML5 and works on Firefox currently.A file input has an associated
filesproperty which tracks the list of files currently selected for that input. To display a file from this list, create a newFileReaderobject, initialize itsonloadevent handler, and read the file as a data URL.Once the file is loaded, you will have access to its contents in a data url scheme, for instance:
Create a new Image and set its
srcattribute to this data string.See a working example here. Firefox only.