Hi,

I am facing some problems while uploading a file using Struts' FormFile
object.
I want to allow user to upload only .xls/.tdt/.txt files. For that I am
comparing the ContentType of the file being uploaded using FormFile's
getContentType() method.
The problem is, when I upload .xls files, it properly returns a string as
'application/vnd.ms-excel' so that i can compare it with constant and
proceed further.
But when I upload .tdt or .txt files, it returns a string
'application/octet-stream' instead of 'text/plain', So when i compare it
with the constant(which is set to "text/plain"), test fails even if user has
uploaded proper file with proper contents.
Moreover, this only happens on my machine, If I test it on some-one else'
machine(one of my colleague), it works fine.
So, my question is, is there some setting in my browser that is making the
formfile object to send wrong mime type or this is really a problem? And if
it is related to browser setting, what setting should I change? also, if
user also has that setting in his browser, how should I handle it?

please reply ASAP...

thanks in advance,
Abhijeet.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

http://java.sun.com/products/jsp
http://archives.java.sun.com/jsp-interest.html
http://forums.java.sun.com
http://www.jspinsider.com

Reply via email to