using explode to determin filetypes
Moderator: General Moderators
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
IIS installs won't have it. How many Windows servers run Apache? I'd say not many. Hell, my local Apache install doesn't even respond to it.
But this choice is for my project(s). It's fine for anyone else.
edit: I just realized what I was thinking of before with the magic file, I was thinking of the types file. Der! Turns out I've got a corrupt (blank) magic file too. meh.
Thinking about it, it shouldn't be hard to build a simple function that performs the same actions as mime_content_type() independent of Apache (if PHP doesn't do it in some fashion already.) Unless my cold is much worse than I think it is, I don't recall a facility that does this on IIS that PHP will use. hmmm...
But this choice is for my project(s). It's fine for anyone else.
edit: I just realized what I was thinking of before with the magic file, I was thinking of the types file. Der! Turns out I've got a corrupt (blank) magic file too. meh.
Thinking about it, it shouldn't be hard to build a simple function that performs the same actions as mime_content_type() independent of Apache (if PHP doesn't do it in some fashion already.) Unless my cold is much worse than I think it is, I don't recall a facility that does this on IIS that PHP will use. hmmm...
Last edited by feyd on Thu Jan 04, 2007 12:48 pm, edited 1 time in total.
I don't see the point. IIS installs don't have php either and yet people are using it.feyd wrote:IIS installs won't have it.
it's the file conf/magic.feyd wrote:Hell, my local Apache install doesn't even respond to it.
Btw: php-5.2.0-Win32.zip from php.net ships with the file extras/mime.magic
What do you use to determine the content type of a file?feyd wrote:But this choice is for my project(s). It's fine for anyone else.
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
In case you missed it, I've edited a bit into my last post...
Anyways, I basically do the same as mime_content_type() does except I look it a little deeper and verify a lot more information than strictly the header tag.
It can require more work in the long run (like when the file specifications change) but I prefer to be pretty safe over loose and free.
Anyways, I basically do the same as mime_content_type() does except I look it a little deeper and verify a lot more information than strictly the header tag.
It can require more work in the long run (like when the file specifications change) but I prefer to be pretty safe over loose and free.
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
....
Uniform Server has no installer, you just run a batch file to start apache (and optionally mysql).
I like it because it's completely portable, completely configurable, and it's similar to most production servers.
You can drop-in a replacement for php, apache, etc... no problems.
I don't mean to bash IIS, I just wanted to know if there was a reason you used it instead.
Uniform Server has no installer, you just run a batch file to start apache (and optionally mysql).
I like it because it's completely portable, completely configurable, and it's similar to most production servers.
You can drop-in a replacement for php, apache, etc... no problems.
I don't mean to bash IIS, I just wanted to know if there was a reason you used it instead.
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
I don't use IIS personally -- I run Apache -- But my projects tend to be run on a variety of servers, including IIS. This removes things would normally be available under Apache, let alone Unix.Kieran Huggins wrote:....![]()
Uniform Server has no installer, you just run a batch file to start apache (and optionally mysql).
I like it because it's completely portable, completely configurable, and it's similar to most production servers.
You can drop-in a replacement for php, apache, etc... no problems.
I don't mean to bash IIS, I just wanted to know if there was a reason you used it instead.
Again - only for clarity for someone who didn't read the whole thread - the mime.magic file ships with php, mime_content_type does not need apache or an unix environment and it does examine parts of the contents of the file to test.
Of course, if you need a more in-depth-test you will need something else. But to assure the file is not of another content type mime.magic is feasible. Testing the filename or parts of it is insufficient.
Of course, if you need a more in-depth-test you will need something else. But to assure the file is not of another content type mime.magic is feasible. Testing the filename or parts of it is insufficient.