473,473 Members | 1,923 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

getting mimetype of a file

is there any way to determine the mimetype of a file using ruby?

TIA

--SegPhault
Jul 18 '05 #1
4 2260
On Mon, 31 May 2004 19:54:53 +0000, Ryan Paul wrote:
is there any way to determine the mimetype of a file using ruby?

TIA

--SegPhault


=P just realized I sent this to the wrong list. as long as I'm here... how
is it done in python?

Jul 18 '05 #2
On Mon, 31 May 2004 19:58:10 GMT, rumours say that Ryan Paul
<se*******@sbcglobal.net> might have written:
is there any way to determine the mimetype of a file using ruby?
[snip]=P just realized I sent this to the wrong list. as long as I'm here... how
is it done in python?


The mimetypes.py module in the standard library is your friend.
--
TZOTZIOY, I speak England very best,
"I have a cunning plan, m'lord" --Sean Bean as Odysseus/Ulysses
Jul 18 '05 #3
Christos TZOTZIOY Georgiou wrote:
is there any way to determine the mimetype of a file using ruby?

[snip]
=P just realized I sent this to the wrong list. as long as I'm here... how
is it done in python?


The mimetypes.py module in the standard library is your friend.


A more effective approach would be to use the "magic" module that come
with the "file" utility (it is present in the sources, but not built by
default).
This way you can perform a fine-grained recognition of files..

Matteo
Jul 18 '05 #4
On Wed, 02 Jun 2004 08:52:20 GMT, rumours say that Matteo Merli
<ma**********@studenti.unipr_punto_it> might have written:
Christos TZOTZIOY Georgiou wrote:
is there any way to determine the mimetype of a file using ruby? [snip]
=P just realized I sent this to the wrong list. as long as I'm here... how
is it done in python?


The mimetypes.py module in the standard library is your friend.


....if one wants to judge by the filename only (I wasn't clear earlier).
A more effective approach would be to use the "magic" module that come
with the "file" utility (it is present in the sources, but not built by
default).
This way you can perform a fine-grained recognition of files..


Indeed. One such attempt (mine) to use the "magic" file from python can
be found here:

http://www.sil-tec.gr/~tzot/python/
--
TZOTZIOY, I speak England very best,
"I have a cunning plan, m'lord" --Sean Bean as Odysseus/Ulysses
Jul 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: GR33DY | last post by:
Hello again, I can see myself becoming a regular feature at the top here ;) When I view my XML page using I.E.6 it displays fine from both my web server and when opened from windows explorer....
5
by: Ian | last post by:
(Please excuse the rookie question) Why don't I get the value of "windows" in my file? My xml file is located in http://www.otima.ca/XML/auto.xml and the xslt file is...
9
by: Robert Schneider | last post by:
Hi to all, I don't understand that: I try to delete a record via JDBC. But I always get the error SQL7008 with the error code 3. It seems that this has something to do with journaling, since the...
1
by: Patrick F | last post by:
I cant figure out what mimetype .aspx pages are, i have been searching thru msdn and the only thing that i found was a way to list all mimetypes installed on the computes, output something like...
1
by: durayakar | last post by:
Hi, SQL 2005 Reporting services... I get a warning of rsInvalidMIMEType when the MIMEType of my external (http) image is Image/Jpeg or Image/JPEG... posting it here for future reference......
7
by: Nathan Sokalski | last post by:
I would like to be able to get the ContentType of a file programmatically (for example, I want *.txt files to return "text/plain"). I could not find a way to do this using VB.NET's classes, but I...
0
by: imranabdulaziz | last post by:
Dear All, I am making web application using Asp.net C#(Visual Studio2005). And Sql server 2005 as a back End I generated local mode report but as there was no printing option available . I assign...
0
by: forge1968 | last post by:
I want to handle URLs like this on my IIS site: http://localhost/myapp/REST/foo/1 ('REST/foo/1' doesn't exist - I'll dynamically create the content). I have implemented my own...
0
by: NehaDas | last post by:
Hello der ! at my wits end and cant figure out what is the problem.. my task is to programmatically configure IIS , part of which is to add MIMETypes... after googling for a like a million...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.