homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

file type
nick patrick

 11:53 pm on Jan 24, 2009 (gmt 0)

how do i get file type from mysql uploaded file using php
example something which will out like .zip .tar etc i have different type of files in a table and there is nothing which will say what type is it any code to out with php ?



 11:59 pm on Jan 24, 2009 (gmt 0)

I don't understand the question.

Are you talking about MIME types?

nick patrick

 12:02 am on Jan 25, 2009 (gmt 0)

no see for example, i have a file uploaded in mysql and i want to know which file is this like name.?
is .gif .jpg which one the file uploaded in mysql longblob

nick patrick

 12:23 am on Jan 25, 2009 (gmt 0)

no getting my point some more details here
i am saying about header("Content-type: ");
i have files in mysql table but i dont no the type of files there are different different files like .zip .gif and only longblob and id to get nothing is saying the type so is there any way to get the file type and show using header("Content-type: TYPE HERE");


 5:00 am on Jan 25, 2009 (gmt 0)

Did you store the Content-type information? If not, you'll have to look at the file contents. (See the unix file command as an example.)

nick patrick

 8:30 pm on Jan 25, 2009 (gmt 0)

any example please

nick patrick

 9:50 am on Jan 26, 2009 (gmt 0)

no i have not stored the Content-type that's why asking :) if i have so i know how to get now at my point i have to get from the file data please replay its much important for me


 5:58 pm on Jan 26, 2009 (gmt 0)

For certain image types you can use the PHP exif_imagetype [php.net] function. Anything other than images you may have to use either a system command as mentioned. PHP once had a function called mime_content_type [us.php.net] but that has been deprecated. File Information [php.net] is looking to be it's replacement.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved