The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Type I and Type II Errors - The Heart of Event Processing iBot Complex Event Processing RSS News 0 12-05-2007 06:50 PM
array type has incomplete element type jaganadh High Level Programming 1 07-24-2007 03:54 AM
Lynx - Downloading - extension handling - changing mime type? yitzle UNIX for Dummies Questions & Answers 2 10-17-2006 11:46 PM
human readable format of file size when doing ls –l umen UNIX for Dummies Questions & Answers 1 09-28-2005 09:20 AM
How to Set Mime type to mailx suneel UNIX for Advanced & Expert Users 1 07-08-2003 11:17 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-22-2007
spauldingsmails spauldingsmails is offline
Registered User
  
 

Join Date: Mar 2007
Posts: 1
Human readable type vs MIME type detection using file

Hi

I am currently using the file command to detect the file type of a number of documents I have, including ODT, PDF and MSWord to name but a few. Additionally this list of files has no extension and so I must go on the file type alone to work out which file is of what type.

I can use the file command successfully to obtain the human readable file type;
e.g. ODT = OpenDocument Text, PDF = PDF Document, version ..., DOC = MS Office Document but when I specify the --mime flag I get alternative values. For ODT = OpenDocument Text = application/x-zip but it should really be application/vnd.oasis.opendocument.text or so I can see in the /usr/share/file/magic file. I have had the same problem with multimedia files as well, especially video where I get the correct human readable type every time but the mime type is nearly always reported as application/octet-stream.

The reason I need the mime type is that I would like to stream some of these documents to a client's web browser and I need to tell the browser the MIME type of the file.

$ file --version reports the following
file-4.17
magic file from /etc/magic:/usr/share/file/magic

Is there some way I can get the correct MIME type? Should I be using file or is there another command I should be using? Any help would be much appreciated.

Last edited by spauldingsmails; 03-22-2007 at 12:50 AM..
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:15 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0