commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vijay shanker <vijay.s...@gmail.com>
Subject Re: File upload: not identified content type.
Date Fri, 06 Nov 2009 18:50:21 GMT
Thanks guys;

I am using spring-mvc for my web application. So have been looking in to the
spring lib to get some thing relevant. But sorry to say; I have got no
results.

I think finding with file extension will do and will save me every time.

May be spring lib has some thing to support me; any body can point!

Regards,
Vijay Shanker Dubey



On Fri, Nov 6, 2009 at 11:00 AM, Raghuveer.V <raghuveerv@infotechsw.com>wrote:

> 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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message