From: Logan Capaldo Date: 2006-06-24T09:52:57+09:00 Subject: Re: Accessing content_type locally On Jun 23, 2006, at 10:24 AM, Larrytheliquid wrote: > Hi, > > I'm trying to figure out a way to get the same information that you > would > from the "content_type" method of the CGI class. > The problem is that I want to get this info from a file already in the > filesystem locally. For example, using ruby's File.size would give > me the > same info as an uploaded CGI object's size method. However, the > file class' > "ftype" method only gives things like "file", "directory", etc > whereas CGI > "content_type" (what I want) gives things like "image/png". > > File class: http://www.ruby-doc.org/core/classes/File.html#M000016 > CGI class: http://www.ruby-doc.org/stdlib/libdoc/cgi/rdoc/classes/ > CGI.html > > -- > Respectfully: > Larry Diehl I think this is as close are you are going to get: http://raa.ruby- lang.org/project/filemagic/ You have to remember that MIME types are placed in the headers by the web-server.