如何仅上传GWT文件中的图像 [英] How to upload only images in GWT fileUpload

查看:59
本文介绍了如何仅上传GWT文件中的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将一个图像文件上传到我的应用程序中.我正在使用GWTFileUpload组件可以上传文件.但是当我使用FileUpload时FileUploadDialog显示所有文件.我需要进行设置仅用于图像文件.我该如何设置过滤器?

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?

谢谢

Ajinkya.

推荐答案

HTML< input>已接受属性 http://www.w3schools.com/tags/att_input_accept.asp

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

在GWT上做到这一点

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

这篇关于如何仅上传GWT文件中的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆