You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by arunabh <ar...@iflexsolutions.com> on 2009/03/23 15:56:17 UTC

The MIME type of while uploading .dbf files

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 
-- 
View this message in context: http://www.nabble.com/The-MIME-type-of-while-uploading-.dbf-files-tp22661797p22661797.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


Re: The MIME type of while uploading .dbf files

Posted by Musachy Barroso <mu...@gmail.com>.
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)

musachy

On Tue, Mar 24, 2009 at 12:11 PM, Greg Lindholm <gl...@yahoo.com> wrote:
>
>
>
> 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
>
>



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

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


Re: The MIME type of while uploading .dbf files

Posted by Greg Lindholm <gl...@yahoo.com>.


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