Forum Moderators: coopster
I'm running into trouble with m4a files and servers that have the mime-type for them set as text/html. I'd like an alternative way to get the mime-type
Wouldn't an alternate solution present you with the same problem?
However you could look at downloading the first, say, 100 byes then examine those for the file markers, to see what type of file they actually are...although I guess that isnt really a realistic solution.
So is there another way to look at the problem -
why do you need the mime type is you already know its m4a?
are you only looking for files with that single mime type?
are you looking blindly for all files then picking m4a types, or do you know the location of those files and are just checking with the headers?
m4a just happens to be the first one I ran into where my test cases didn't match up with what I already knew to be the file type. I'm running a test script on 300 or so DB entries before trying it on the larger DB.
--> are you only looking for files with that single mime type?
No. I have a DB of URLs pointing to various pages/files/media and I'm trying to separate them out by media type, where possible. The four large categories I'm using are htmt/text, images, audio, and video. I'm specifically interested in mp3 and m4a files because I want to play them through a flash player.
--> are you looking blindly for all files then picking m4a types, or do you know the location of those files and are just checking with the headers?
I have specific URLs in my DB but within those it's a blind sorting process. Right now I'm using a combination of grabbing the mime type using get_headers() and also grabbing the extension (if one is displayed) using pathinfo() which is better than one or the other but not as reliable or elegant as I'd like.
Are all of these files that you are having problems with on a single server?
You could separate out results from those offending servers and maybe have to check them manually, until a better solution is found.
Is it your server?
As you can add the m4a type so that the server will send the correct heading. Or if not yours then try talking to the server admin to get them to add the correct mime type headers for those files.
No, it seems like a lot of servers on the web aren't currently configured to handle m4a correctly. I suppose since it's a (relatively) new format hosting providers haven't gotten around to adding it to the list.