Re: adding filter to file upload in gwt
I'm actually surprised that it worked; what browser, and how did it
represent that setting to the user?
Keep in mind that there's no guarantee that this will work in all
browsers; the W3C spec says only that this "provides the user agent
with a hint of file types to accept". How it does that is up to the
browser, and the browser is free to give the user the option to select
any file, notwithstanding your list of acceptable MIME types. So
you're still going to want to validate the file when the user clicks
the submit button.
http://www.w3.org/TR/html-markup/input.file.html
ⓘ accept = list of MIME types
Provides the UA with a hint of what file types the server is able to
accept.
A set of comma-separated strings, each of which is a valid MIME type,
with no parameters.
On Jul 6, 10:06 pm, aman <bhatia.ama...@gmail.com> wrote:
> Hi,
> Thanks for your help it really worked,but it is also giving me the
> option in the browsing window to select "All files" can I remove this
> option?
>
> Thanks,
> Amandeep
>
> On Jul 7, 4:40 am, Jim Douglas <jdou...@basis.com> wrote:
>
>
>
> > Untested, and no guarantees, but try something like this:
>
> > String mimeList = "application/vnd.ms-excel,application/
> > msexcel,application/x-msexcel,application/x-ms-excel,application/
> > vnd.ms-excel,application/x-excel,application/x-
> > dos_ms_excel,application/xls,application/vnd.openxmlformats-
> > officedocument.spreadsheetml.sheet";
>
> > myFileUploadWidget.getElement().setPropertyString("accept", mimeList);
>
> > Reference:
>
> >http://www.w3.org/TR/html-markup/input.file.html
>
> > On Jul 5, 11:18 pm, aman <bhatia.ama...@gmail.com> wrote:
>
> > > I am using the basic FileUpload control ingwtand wanted to add the
> > >filteron the extensions allowed in the browsing window, which
> > > restrict the user to select only specific extensions (like xls,xlsx
> > > etc). Tell me how I can achieve this as I want to restrict on the
> > > browsing window itself and cant wait for the Button submit event.
>
> > > Thanks
>
> > > Amandeep
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home