This week's giveaway is in the Programmer Certification (OCPJP) forum.
We're giving away four copies of Java Mock Exams (software) and have David Mayer on-line!
See this thread for details.
Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Uploading Images using Struts

 
Vikram Virk
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to know how can I restrict the size and type of file being uploaded using Struts.My application is uploading any type of file.I am saving file to a folder in my harddisk.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at the upload example in the struts-examples.war file that comes with the Struts download. It gives an example of how to give an error message if the uploaded file exceeds a certain size. As for restricting what types of files to upload, you could simply look at the file extension and accept or reject a file based on that.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!