struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Musachy Barroso <>
Subject Re: The MIME type of while uploading .dbf files
Date Tue, 24 Mar 2009 17:38:58 GMT
This reminds me of a Jira ticket sometime back, which was caused by
Safari picking some weird contentType. As Greg said, defining the
contentType is up to the browser and it is unreliable at best (and
useless at worst)


On Tue, Mar 24, 2009 at 12:11 PM, Greg Lindholm <> wrote:
> arunabh wrote:
>> Hi ,
>> I am trying to do a restricted file upload .
>> I have used
>>  <interceptor-ref name="fileUpload">
>> text/plain,application/,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:
> Sent from the Struts - User mailing list archive at
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

"Hey you! Would you help me to carry the stone?" Pink Floyd

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message