Hello,

even if getContentType() would return the 'correct' value (and it should
work - are you invoking ServletContext#getMimeType?), the user would still
be able to rename their zip files to .rar and pass your validation. What I'm
trying to say is that simply checking the extension does not really give you
any certainty that the user uploaded a rar file. There are a number of
libraries that examine file headers to find out their mime types. I don't
have experience with any, but I read about one on the server side recently (
http://www.theserverside.com/news/thread.tss?thread_id=53172).

Regards,
  Levi

On Sun, Feb 15, 2009 at 7:25 AM, ziscloud <[email protected]> wrote:

>
> Hi,
> I'm using stripes 1.5 to develop one online submission system, and the user
> will upload their paper and other document as one rar file.
> The problem is that in the action bean, I must validate the type of the
> file
> user try to upload, but I invoke the getContentType()  method of FileBean,
> I
> just get application/octet-stream.
> I have add below code into the web.xml of tomcat,
> <mime-mapping>
> <extension>rar</extension>
> <mime-type>application/rar</mime-type>
> </mime-mapping>
> What I can do to get the correct contentType?
> Thx!
>
> --
> View this message in context:
> http://www.nabble.com/problem-of-Rar-file-uploading-tp22019914p22019914.html
> Sent from the stripes-users mailing list archive at Nabble.com.
>
>
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco,
> CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the
> Enterprise
> -Strategies to boost innovation and cut costs with open source
> participation
> -Receive a $600 discount off the registration fee with the source code:
> SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> Stripes-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to