You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by akash agrawal <ak...@yahoo.co.uk> on 2008/03/17 22:46:23 UTC

uploaded image file contentType (IE vs Firefox)

Hi,

I am using fileuploadinterceptor which is part defaultStack. I upload an image *.jpg using IE and Firefox and get a different contentType in action for different browser.
IE returns content type as image/pjpeg whereas Firefox returns content type as image/jpeg.
Similary for a *.png image uploading using IE and Firefox returns different content types. IE returns content type as image/x-png whereas Firefox returns image/png.

What can I do to resolve this conflict and not get different content types? Is there other property which can be accessed regarding the image types (like mime type)?
Anyone else came across such a use case?

Thanks.

       
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.

Re: uploaded image file contentType (IE vs Firefox)

Posted by Dave Newton <ne...@yahoo.com>.
--- akash agrawal <ak...@yahoo.co.uk> wrote:
> I have to support both IE and Firefox so can't use just one browser.

I was kidding.

> Yes, I can do some processing on the server side and handle image/pjpeg and
> image/jpeg as same and image/x-png and image/png as same but would prefer
> not to as decoding these images requires different decoders and may get
> into some trouble down the road.

I don't know what you're doing with the files that they need decoding anyway,
but it probably doesn't matter. If you're that concerned then you'll probably
need to sniff the file yourself to determine the content type. Searching the
web may give you some leads on what libraries are available.

I don't know of a way to control what the browser sends as an upload content
type; each browser sniffs the files differently, but someone else may have
some ideas.

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: uploaded image file contentType (IE vs Firefox)

Posted by akash agrawal <ak...@yahoo.co.uk>.
Thanks for the reply Dave.

I have to support both IE and Firefox so can't use just one browser.

Yes, I can do some processing on the server side and handle image/pjpeg and image/jpeg as same and image/x-png and image/png as same but would prefer not to as decoding these images requires different decoders and may get into some trouble down the road.
I was wondering if this is an issue of combination of browser and struts framework and if there is access to more properties which can give more information about the uploaded images.

Thanks.

Dave Newton <ne...@yahoo.com> wrote: --- akash agrawal  wrote:
> What can I do to resolve this conflict and not get different content types?

Only use one browser?

Can't you just do some processing/aggregation of content types on the server
side?

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org



       
---------------------------------
Never miss a thing.   Make Yahoo your homepage.

Re: uploaded image file contentType (IE vs Firefox)

Posted by Dave Newton <ne...@yahoo.com>.
--- akash agrawal <ak...@yahoo.co.uk> wrote:
> What can I do to resolve this conflict and not get different content types?

Only use one browser?

Can't you just do some processing/aggregation of content types on the server
side?

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org