• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

file upload problem using internet explorer 8

 
debraj mallick
Ranch Hand
Posts: 188
Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ranchers,

i am using struts2 to upload image file, it works in all browsers excepts ie8, the exception i am getting is


in my struts.xml


i didn't understand why i am not able to upload image file in ie8, do i have to put some extra code for browser compatibility
any help would be appreciated.
 
Joe Ess
Bartender
Posts: 9312
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
debraj mallick wrote:hi ranchers,








Now do you see the problem?
 
debraj mallick
Ranch Hand
Posts: 188
Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

i don't know what is "image/pjpeg".
 
Joe Ess
Bartender
Posts: 9312
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's a progressive JPEG. Add it to the list of allowed file types and you should be fine.
 
debraj mallick
Ranch Hand
Posts: 188
Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it works
thanks a lot.
 
Mohana Rao Sv
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's why don't depend on allowed contentType approach, otherwise you will face cross browser compatibility issues. Do it manually yourself using this class http://download.oracle.com/javase/6/docs/api/javax/activation/MimetypesFileTypeMap.html. The weird problem i faced mentioned allowed types image/jpeg and i'm uploading a jpeg file but the browser is identifying that file as application/oct-stream and not allowing to upload. Never give a chance to decide your file content type and different browsers will identify the file content type differently sometimes.
 
Mohana Rao Sv
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here, identifying the file contentType by using file extension, Let us assume a smart user modified the file extension. Obviously it will give wrong mime type. What we can do more make it more accurate?

Source code from MimeTypesFileTypeMap.java

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic