commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Raghuveer.V" <raghuve...@infotechsw.com>
Subject RE: File upload: not identified content type.
Date Fri, 06 Nov 2009 05:30:41 GMT
Please validate on client side if file is uploaded and in serverside side
check for extension of file before checking application/octet-stream


if(file!=null){
                strFileName = file.getFileName();
                stContentType = file.getContentType();

 }

if ( strFileName != null && !strFileName.trim().equalsIgnoreCase("")) { //if
filename not null
 
strExtension=strFileName.substring(strFileName.lastIndexOf(".")+1);
strExtension=strExtension.toUpperCase();
if("application/octet-stream".equalsIgnoreCase(stContentType)
  ){
/////process///
}
}

Regards,
Raghuveer

-----Original Message-----
From: vijay shanker [mailto:vijay.shad@gmail.com] 
Sent: Wednesday, November 04, 2009 10:56 PM
To: user
Subject: File upload: not identified content type.

Hello friends;

I am using commons file upload library to upload files. I have been noticing
some time my library does not get file content type correct. For such a file
it saves *application*/*octet*-*stream. *

Can any body describe how it does happens?

If some of you have known for such a situation. Please share the
information.
**
Regards,
Vijay Shanker Dubey
Ph: +91-9818311884


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


Mime
View raw message