struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Lindholm <glindh...@yahoo.com>
Subject Re: The MIME type of while uploading .dbf files
Date Tue, 24 Mar 2009 16:11:10 GMT



arunabh wrote:
> 
> Hi ,
> 
> I am trying to do a restricted file upload .
> 
> I have used 
> 
>  <interceptor-ref name="fileUpload">
>                 
> 				    
> text/plain,application/vnd.ms-excel,application/dbf,application/dbase,application/x-dbase,application/x-dbf,zz-application/zz-winassoc-dbf,application/x-msdownload
>        
>                 </interceptor-ref>
> 
> For me .txt files and .csv files are working fine but .dbf(i.e Microsoft
> Visual FoxPro Table type ) files are not working . 
> 
> The error is 
>  Content-Type not allowed: upload
> "upload_abfbeb3_12033a3b84f__7f9e_00000002.tmp" application/octet-stream. 
> 
> Please suggest me what should put for the content type for .dbf . 
> If i put add the application/octet-stream content type then it works , but
> at that time it allows .exe files also which i don't what . Please suggest
> me what should i do .
> 
> With Regards
> Aruabh 
> 

>From what I can tell (if I'm wrong, some please correct me) the content-type
is picked by your browser using whatever magic it has to determine the file
type.  I just did a test and uploaded a .mp3 file using IE and got a
contentType="audio/mpeg" which looks correct.  I uploaded the same file with
Firefox and got a contentType="audio/x-amzaudio" huh? I have an Amaozn audio
plugin install in Firefox, it is NOT the default app for .mp3 files but for
some reason FF picked it as the content type.
So the lesson is you can't count on the browser picking the correct type,
and different browsers will pick different types (who knows how your user's
browser is configured or what it will pick for a given file.)

With respect to your question, your browser likely doesn't know what a
".dbf" file is (why would it?) and it probably defaults to
"application/octet-stream" which simply mean "unknown binary data".

I would avoid the "allowedTypes" since you can't count on them being
accurate and do my own validation in the action class.


-- 
View this message in context: http://www.nabble.com/The-MIME-type-of-while-uploading-.dbf-files-tp22661797p22683831.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Mime
View raw message