This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization 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: 64631
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: 64631
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