采取输入img类型选择的图片并加载到图像标签 [英] taking an input img type selected picture and load into an image tag
问题描述
这样的事情:
http://jsfiddle.net/QC2c4/
这将是一个客户端验证者,以显示用户将要上传的东西。我知道我需要检查有效的img类型,.png,.bmp,.png,.tiff等的扩展名。
我会去链接过程?
这是答案,作为一个额外的奖金我加载到预览窗格的图像给你的。关键是从文件选取器中取出文件[0]
对象。
So, i have an input box for doing a img file upload. What i was wanting to do is take the data from that (or the selected source) and route that into the src attribute of an image tag.
something like this: http://jsfiddle.net/QC2c4/
It is sort of going to be a client side verifier to show what the user is going to upload. I know that i am going to need to check the extension for the valid img types, .png, .bmp, .png, .tiff, etc, etc.
How would i go about the linking process?
Here's the answer, and as an added bonus I loaded the image into the preview pane for ya. The key is pulling the files[0]
object from the file picker on change.
这篇关于采取输入img类型选择的图片并加载到图像标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!