Problem with MIME types

 
Post new topic   Reply to topic    Aprelium Forum Index -> General Questions
View previous topic :: View next topic  
Author Message
Stefan_D
-


Joined: 21 Aug 2006
Posts: 4

PostPosted: Fri Sep 01, 2006 12:06 pm    Post subject: Problem with MIME types Reply with quote

Hello,

I have an Upload section on an Internetsite and I want to allow only certain files for Upload. Therefore I've created a whitelist (PHP script) and everything is working fine besides 3 file types:

1: .tiff should be allowed but it's not working. Although .tiff is implemented in the servers MIME list, I always get the error message: application/octet-stream. That's strange...
2: .rar should also be allowed. After adding: application/x-rar-compressed to the MIME list I still get the same error message as above.
3. .php should be blocked but I can upload this file type. It's not in my whitelist and it's not in the MIME type list. So I added: application/x-httpd-php to the MIME list (file extension php and phtml) but I can still upload those files although they should be blocked because they're not on the whitelist.

Please help me on this problem. I would like to make the Upload function as save as possible.

Thanx,
Stefan
Back to top View user's profile Send private message
AbyssUnderground
-


Joined: 31 Dec 2004
Posts: 3855

PostPosted: Fri Sep 01, 2006 12:41 pm    Post subject: Reply with quote

MIME types do not stop the uploading of files. They tell the server how to execute them. Your PHP upload script is the part that stops these file types. There is a small snippet of code in a recent post on how to do this. Search the forum and you should find it.
_________________
Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk
Back to top View user's profile Send private message Visit poster's website
Stefan_D
-


Joined: 21 Aug 2006
Posts: 4

PostPosted: Fri Sep 01, 2006 2:04 pm    Post subject: Reply with quote

I'll search the forum for that post and I know what MIME types do. My main problem is that I can't upload certain file (e.g. .tiff and .rar) although they are in my whitelist. I've created this php script which allows only file types listed in this whitelist.

Why I can still upload .php files although they're not in this whitelist is quite mysterious to me.

Thanks for your help so far...
Back to top View user's profile Send private message
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Fri Sep 01, 2006 3:41 pm    Post subject: Reply with quote

Stefan_D wrote:
Why I can still upload .php files although they're not in this whitelist is quite mysterious to me.


It seems related to a programming error (or unexpected side effect) in your script. If you want us to review it, please post it here.
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
Stefan_D
-


Joined: 21 Aug 2006
Posts: 4

PostPosted: Mon Sep 04, 2006 8:58 am    Post subject: Problem with MIME types / Upload from Mac and PC Reply with quote

The script seems OK but I'll check it again and post it if I don't get rid of the problem. But another thing seems very strange:

I don't have the same problems with the file upload on different platforms. When trying to upload on a PC (with IE) .tiff and .rar are blocked (although listed in my whitelist) but .php isn't blocked (what it actually should).
When uploading from a Mac (Safari) .tiff is working (why??) but .pps isn't (on a PC it does). Rar-archives also can't be uploaded and .php is blocked (what it should).

This really makes no sense to me. Does anyone have an ideas??

Thanx...
Back to top View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> General Questions All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group