is there a content type command?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers is there a content type command?
# 1  
Old 11-19-2005
Can i change content type?

Hi
I run on a Unix webserver at my university. I have a couple of *.inc files which are include files used for php.

They are all in one folder without an index file. If you go to the folder, you get to see a list of files in that dir.

Some of the .inc have a question mark icon next to it. others have a text icon next to it. I do not know why? They are the same extensions.

All have html tags inside. If you go to each one in a web browser, some files will display as html by the browser. others will display it as text.

Is there a reason behind this due to content type? if so, how do i change it?
Also, i connect using telnet or SSH. if i run ls, some files have an asterisk next to the name. Why is that?

Last edited by aqh2; 11-19-2005 at 12:53 PM..
# 2  
Old 11-19-2005
Your school's Apache probably have mod_mime_magic enabled.

Apache's usual way to determine the icon used on an directory index is by the MIME type of the file (a few others by name). In turn, MIME type are defined by extension (either from AddType directives or mime.types as system default). So the way the icon is determined should be relatively "consistent".

If mime-magic is enabled, it will try to scan the first few bytes of the file in question, in the same way you do it with a file(1) command to determine the type. It matches according to a set of preset signature in a magic file. So, extension is not important if this extension is enabled, so multiple files with same extension may come up with different icons, depending on what is contained in the first few bytes of the file.
# 3  
Old 11-19-2005
Thanks for the answer,
Now i need to know if there is a unix command that i can run that could manually change the mime-type of the file.

The other question is why is there an asterisk next to the filename.
# 4  
Old 11-19-2005
Quote:
Originally Posted by aqh2
Thanks for the answer,
Now i need to know if there is a unix command that i can run that could manually change the mime-type of the file.
You just change the configuration files in Apache to affect Apache. I see no reason to change the system magic file signature as the two are separate.

Please search the Web for more information about this, in particular look for the keywords I used in the previous post.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

"Content-type: text/html No input file specified." Only in CRON but not when executed directly

Hi gang, I have the following code inside a the file script.sh #!/bin/bash todaysdate=$(date --date='7 day' +'%d') todaysmonth=$(date +'%m') todaysyear=$(date +'%Y') yahoodatestring=$todaysyear$todaysmonth$todaysdate nicedate=$(date --date='5 day' +'%A') nice="$nicedate,... (2 Replies)
Discussion started by: phpchick
2 Replies

2. Shell Programming and Scripting

Facing issues with Content-Type:application/x-download Content-Disposition:attachment

I am in the process of developing a perl cgi page. I had succeeded in developing the page but there are few errors/issues with the page. description about cgi page: My CGI page retrieves all the file names from an directory and displays the files in drop down menu for downloading the... (5 Replies)
Discussion started by: scriptscript
5 Replies

3. Shell Programming and Scripting

Determine Content-Type

I am limited to using only libraries that come with the default install of ActivePerl. I'd like to be able to determine the content type of a file on the fly. I thought CGI.pm might do it, but it looks a little weird to me from the perldoc. If someone has a quick way to determine the type of... (4 Replies)
Discussion started by: mrwatkin
4 Replies

4. Shell Programming and Scripting

determine file type by content, not extension

I have a directory structure with multiple sub directories. Within each directory, there are files without extensions. Is it possible to somehow tell what the file type should be by the file contents? For example, I opened one of the files using an editor. After scrolling to the end of the... (2 Replies)
Discussion started by: daflore
2 Replies

5. Programming

type command in PHP

Hello, I am having trouble getting the type command to work in PHP whereas it works fine on the command line with only certain functions... example from PHP script: echo system('type cp'); returns cp is /bin/cp whereas echo system('type mogrify'); returns nothing... whereas from the unix... (1 Reply)
Discussion started by: dave_c00
1 Replies

6. Shell Programming and Scripting

Check file content type

I have a shell script that takes a file and uses "syncsort" to sort contents. I want to add a condition to check whether the input file is textual or binary format. If textual, the "syncsort" will be used to sort the files contents. Otherwise, the sorting process will be skipped. Note that the... (3 Replies)
Discussion started by: synthea
3 Replies

7. Shell Programming and Scripting

Find command return type

Hi all does find command return anything if the file to be searched is not found? Like if I search from a file in a dir does it return false or null if the file is not found? Please suggests. (3 Replies)
Discussion started by: Veenak15
3 Replies

8. AIX

Command to determine Tape Type

I have 2 UNIX boxes and I need to determine whether or not they possess the same tape drive. What is the hardware command to determine what type of tape drive is present? Thx in advance. (4 Replies)
Discussion started by: Surdeymon
4 Replies

9. UNIX for Dummies Questions & Answers

Content-Type

hey.. found out what was wrong. didnt have Read permission of the file for others LOL. But yeah the C version of it, why does it work in Netscape and not IE? primal ----- Hey everyone! Has anyone run into this before... I'm creating a UNIX CGI program that will parse $QUERY_STRING and save... (1 Reply)
Discussion started by: primal
1 Replies
Login or Register to Ask a Question