Browser passes content-type as application/octet-stream

I have a JSP page with a file selector. User selects a document on this page and submits it to the server which then does some processing with the document.

Below is a code snippet -

<form name="import_form" id="import_form" action='<%= request.getParameter("bpurl") %>/http/upload_doc' method="post" enctype="multipart/form-data">
....
<input type="file" class="file" name="doc_import" id="doc_import" onchange="displayDocLabel(this);"/>
....
</form>

Open in new window


when the form is submitted, I have traced this request through Fiddler and noticed that for doc, docx, xls etc the content-type is getting set as application/octet-stream
Content-Disposition: form-data; name="doc_import"; filename="Troubleshooting.doc"
Content-Type: application/octet-stream

Open in new window


However for other types, like pdf, txt, png etc it is being set to the correct content-type. Example,

Content-Disposition: form-data; name="doc_import"; filename="Dok_5.pdf"
Content-Type: application/pdf

Open in new window



For .doc files, I would have expected it to be set as application/msword but that is not the case. Can someone please help me understand why this is happening and what do I need to do to correct this.

Thanks in anticipation.
LVL 1
ank5Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mrcoffee365Commented:
In our system it has to do with the mime type of the file as understood by the server.  So it sounds as if your server doesn't have a mime type definitions for .docx, or if it has one, the definition is application/octet-stream.

Check the web server configuration.
0
COBOLdinosaurCommented:
I don't believe that there is an IANA registration that a server could use so it defaults to the general application MIME type.  I expect that like a lot of ther things MS is out of the mainstream and application/msword is probably only used internally by Office and Windows.  

However even if they exist it is not likely that a web server would be configured to something that specific and proprietary when they have very little use in a web-centric environment.

Cd&
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ank5Author Commented:
the app server does have application/wsword and other mime types defined.

Upon further research I have noticed that if the end user machine (where user is using a browser to upload the file), has MS Office installed then correct mime type gets passed for all MS office formats. If there is no MS Office installed, it always passes application/octet-stream.

Is that a known limitation?
0
mrcoffee365Commented:
COBOLdinosaur: have to agree with some and disagree with others.  Yes, MS is proprietary.  However, all business web sites, if they do any volume and allow any upload or download of MS files, have those mime types defined in their servers.

ank5: I'm not sure what you're trying to say.  Having MS products installed is not a limitation, and not having them installed is not a limitation.  Having web servers which do not have the proprietary MS mime types is not so much a limitation (well, it can have an effect) as a business choice on the part of the web server business owners.

Is there something that you want to have happen which is not?
0
COBOLdinosaurCommented:
If the server s configured to recognize the Office MIME types and not using those MIME types, the the clients sending the file do not have the correct header to indicate what they are.  It is likely that a client without office does not send the correct header which I suspect would be dependent on a registry setting.

The whole issue is really irrelevant unless there is some function that requires the Office MIME type on the server.  As long as the file stores correctly; what is the issue.

Cd&
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JSP

From novice to tech pro — start learning today.