How to upload only images in GWT fileUpload

纵然是瞬间 提交于 2019-12-25 04:24:21

问题


I need to upload one image file into my application. I am using GWT FileUpload compontent to upload the File. But when I use FileUpload, the FileUploadDialog displayed All files.. I need to set it only for image files . How can I set filter for that?

Thanks,

Ajinkya.


回答1:


HTML <input> has accept Attribute http://www.w3schools.com/tags/att_input_accept.asp

do like this on GWT

FileUpload upload=new FileUpload();
upload.getElement().setAttribute("accept", "image/*");


来源:https://stackoverflow.com/questions/21771909/how-to-upload-only-images-in-gwt-fileupload

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!