aspose file tools*
The moose likes Struts and the fly likes file upload problem using internet explorer 8 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "file upload problem using internet explorer 8" Watch "file upload problem using internet explorer 8" New topic
Author

file upload problem using internet explorer 8

debraj mallick
Ranch Hand

Joined: Mar 08, 2011
Posts: 188

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

Joined: Oct 29, 2001
Posts: 8927
    
    9

debraj mallick wrote:hi ranchers,








Now do you see the problem?
debraj mallick
Ranch Hand

Joined: Mar 08, 2011
Posts: 188


i don't know what is "image/pjpeg".
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8927
    
    9

It's a progressive JPEG. Add it to the list of allowed file types and you should be fine.
debraj mallick
Ranch Hand

Joined: Mar 08, 2011
Posts: 188

it works
thanks a lot.
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

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.


ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

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

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: file upload problem using internet explorer 8