Friday, August 24, 2012

html5 – Understanding

I am trying to get my head around and using the selected image in a website.


Let\’s say I have a simple website that lets the user select an image from their system using:



<input type=\"file\" id=\"userImage\">


Then in the JavaScript I can do this to get the file:



var userImage = document.getElementById(\'#userImage\').files[0];


Questions:


1) Can I now use userImage? Such as drawing it on a canvas, or do I need to uploaded it to the websites server first?


2) If I use the image, does the website have to upload it every-time I use it, or does it stay in memory?


3) How do I know when the image is ready to use? (for the same reasons all images should be preloaded at the start before drawn on canvas)


Thanks so much for your help :)


Follow-up


Thanks for your answers. So it looks like it is possible in html5 but not yet universally supported.






Rating: 2 out of 5 based on 3 ratings



The post html5 – Understanding <input type="file"> appeared first on Javascript ASK.






via Javascript ASK http://javascriptask.phpfogapp.com/html5-understanding-input-typefile.html

No comments:

Post a Comment