You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by lu...@bnpparibas.com on 2003/11/24 15:35:18 UTC

Disable binary files in upload


Hi all,

I would like to prevent the user from upload binary files from an upload
form, but to allow him to download any kind of ascii files. What is the
better way to do that?
Is it something i can do with the configuration.? Or should I add a test on
the "content-type" value received ?

Thanks,
Ludo.







This message and any attachments (the "message") is intended solely for the addressees and is confidential. 
If you receive this message in error, please delete it and immediately notify the sender. Any use not in accord with 
its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval. 
The internet can not guarantee the integrity of this message. BNP PARIBAS (and its subsidiaries) shall (will) not 
therefore be liable for the message if modified. 

                ---------------------------------------------

Ce message et toutes les pieces jointes (ci-apres le "message") sont etablis a l'intention exclusive de ses 
destinataires et sont confidentiels. Si vous recevez ce message par erreur, merci de le detruire et d'en avertir 
immediatement l'expediteur. Toute utilisation de ce message non conforme a sa destination, toute diffusion 
ou toute publication, totale ou partielle, est interdite, sauf autorisation expresse. L'internet ne permettant pas 
d'assurer l'integrite de ce message, BNP PARIBAS (et ses filiales) decline(nt) toute responsabilite au titre de ce 
message, dans l'hypothese ou il aurait ete modifie.


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


RE: Disable binary files in upload

Posted by David Friedman <hu...@ix.netcom.com>.
Ludo,

You might want to use a FormFile in your ActionForm bean to make the file
easier to deal with.   Then, you can do things like this:

1. FormFile.getContentType() and see if it is a MIME type you allow.

2. FormFile.getInputStream() and save it in an ascii, not binary mode.  So,
binary data would probably be saved corrupted and they'd know it was bad the
next time they asked for it not to upload binary data.

3. FormFile.getFileName() and see if it is one of a handful of file
extensions you might allow (.html, .txt, etc.)

Regards,
David

-----Original Message-----
From: ludovic.maurillon@bnpparibas.com
[mailto:ludovic.maurillon@bnpparibas.com]
Sent: Monday, November 24, 2003 9:35 AM
To: struts-user@jakarta.apache.org
Subject: Disable binary files in upload




Hi all,

I would like to prevent the user from upload binary files from an upload
form, but to allow him to download any kind of ascii files. What is the
better way to do that?
Is it something i can do with the configuration.? Or should I add a test on
the "content-type" value received ?

Thanks,
Ludo.







This message and any attachments (the "message") is intended solely for the
addressees and is confidential.
If you receive this message in error, please delete it and immediately
notify the sender. Any use not in accord with
its purpose, any dissemination or disclosure, either whole or partial, is
prohibited except formal approval.
The internet can not guarantee the integrity of this message. BNP PARIBAS
(and its subsidiaries) shall (will) not
therefore be liable for the message if modified.

                ---------------------------------------------

Ce message et toutes les pieces jointes (ci-apres le "message") sont etablis
a l'intention exclusive de ses
destinataires et sont confidentiels. Si vous recevez ce message par erreur,
merci de le detruire et d'en avertir
immediatement l'expediteur. Toute utilisation de ce message non conforme a
sa destination, toute diffusion
ou toute publication, totale ou partielle, est interdite, sauf autorisation
expresse. L'internet ne permettant pas
d'assurer l'integrite de ce message, BNP PARIBAS (et ses filiales)
decline(nt) toute responsabilite au titre de ce
message, dans l'hypothese ou il aurait ete modifie.


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


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