问题
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