Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File upload

 
Nit Kul
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

In JSP <input type="file/> gives an option to choose local file using the file chooser menu.
How can I restrict this menu, to allow users to upload just JPG files?

Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64843
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not a JSP question. Moved to the HTML forum.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64843
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't. You'll have to check it on the server after the upload.
 
Nit Kul
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Thanks for reply,

<input TYPE="file" name="filename" accept="image/jpg"/>

I used accept option, after reading it in some of other forums. But this did not work.
Is there anyway I could make accept work?

Thanks again
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The answer is still no--most (all?) browsers ignore the attribute.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic