• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

struts 2 file upload problem

 
vik ar
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. I have the following code:


Now when I attempt to upload a image file (1.jpg) it uploads fine in firefox, but in ie7 I get an error saying content type is not allowed?
 
Ankit Garg
Sheriff
Posts: 9529
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The reason that I can think of is that IE is not setting the content type of the uploaded file properly. Try to map jpg files to image/jpeg content type using the <mime-mapping> tag of the web.xml. It might work then...
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could also check what the actual mimetype is--might it be "image/jpg"?
 
galne vaibhav
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you are making mistake you mention alloewed type as image/jpeg and trying to upload image/jpg

just open the file in paint save as .jpeg format and try to upload
 
Ankit Garg
Sheriff
Posts: 9529
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Galne as I said here, don't put whatever you say in [quote] [/quote] tags. It looks as if you've just quoted what someone else has said and not written anything of your own...
 
vik ar
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I have put the following in web.xml. Still no luck
 
Ankit Garg
Sheriff
Posts: 9529
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vik, can you upload .jpeg files from IE (as galne said)?? Also can you show us the code i.e. the JSP page where the file upload control is...
 
vik ar
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry I just checked in windows explorer details view and it specifies the file is of type JPEG Image. The following is the jsp
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic