[PHP] RE: MIME Types [fixed]
> The closest I have found on my google is the > "application/msexcel" type, but this spawns Excel when > viewing the file, and I do not want this behaviour. Not sure what is happening with the list this morning, but it is eerily quiet! Anyway, a little bit of tinkering and I found that the answer was stupidly simple. The correct header to send is "text/plain" - doh! Regards, Mikey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Mime Types
you could use the command "file -bin your_filename" and capture the output using popen or exec. i have found this to work well.. seee below function mimetype($file) { // execute command $fp = popen("file -bin $file","r"); // determine mimetype to output if(!$fp) { // default mimetype if no mimetype exists $mimetype="application/octet-stream"; } else { // iterate through return value to determine mimetype while($string=fgets($fp, 1024)) { $mimetype .= $string; } pclose($fp); } // return output return $mimetype; } Php List wrote: > Hi, > Is it possible to get a mime type of a file? > I need to be able to attach files, but I won't always know the mime type of what is >being attached. > I could look at the extension of the file for a general Idea, but I wouldn't know if >a .jpg file is an image/jpg or image/jpeg.(progressive) and there seems to be a >difference between the two. > > Thanks for any help. > Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Mime Types
Hello, On 10/03/2002 07:41 PM, Php List wrote: > Hi, > Is it possible to get a mime type of a file? > I need to be able to attach files, but I won't always know the mime type of what is >being attached. > I could look at the extension of the file for a general Idea, but I wouldn't know if >a .jpg file is an image/jpg or image/jpeg.(progressive) and there seems to be a >difference between the two. This class that can compose and send messages with attachments already guess the MIME type for you from the file name extension: http://www.phpclasses.org/mimemessage -- Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Mime types?
If I remember correctly, there are various articles about file upload in sites such as www.phpbuilder.com, www.codewalkers.com and such. Hope that helps you get started :) -Joni- -- // Joni Järvinen // [EMAIL PROTECTED] // http://www.reactorbox.org/~wandu "Wm" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Is there a resource somewhere that would show what the various MIME types > are? For a file upload page, I want to include .TIF, .AI, .PSD, etc., in > addition to the "standard" GIF and JPG types... > > Thanx, > Wm > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php