Extension issue

Posted by imad77, 04-20-2009, 10:39 AM
Hi, I run a Perl/CGI script from a Web page to download some files located in a Linux server. When I click from a Windows XP on the link of the file to download via this Web page (IE), a dialog box will be displayed to ask me to "Open" or "Save" the file (.txt, .doc, .xls,...) but for some extensions like ".dat" or ".asc", the dialog box ask me to save it only and I have not an "Open" button. I tried to configure Apache to add these extensions as text/plain by adding these lines in http.conf: AddType text/plain .asc .txt .dat How can I add these extensions (.dat, .asc and other extensions) to Apache configuration to be able to open it with Textpad or Notepad? I hope that the users will be able to open it with Notepad or TextPad without saving it. I know that we can add this type directly in the stations XP but I have a lot of users and I cannot manage that. I hope to perform it from the server. I think something is wrong or missing in my AddType, AddHandler or LoadModule? Can someone help me to fix this issue in the httpd.conf? Thanks Imad77

Posted by Ranthalas, 04-20-2009, 10:57 AM
This doesn't sound like a problem in your apache config, but rather with your windows machine. Windows doesn't know how to open or handle those files. If you want to be able to just open them in notepad you'll need to associate those filetypes with notepad in Windows. Here are some web resources on how to accomplish this: http://kb.iu.edu/data/adhc.html - windowsXP http://www.tech-recipes.com/rx/2127/..._type_program/ - Windows Vista HTH Dave

Posted by imad77, 04-20-2009, 10:59 AM
Hi, I know how to perform it from Windows, but I cannot perfom this action on all computers and I have a lot of extnesions to define. Apache provide this feature and we can do it centrally. Do you agree with me? Thanks a lot.

Posted by Ranthalas, 04-20-2009, 11:12 AM
Other than adding the application type I'm not aware of another way to do this. I know apache can tell the client what general type of file it is, but if the client doesn't know how to handle it you'll still have a problem. I'll do some sniffing around and see if I can find out any more as this is a rather intriguing question. Dave

Posted by hiabhilash, 04-20-2009, 11:38 AM
May be the linux box has compression enabled ? AFAIK, IE ignores Content-disposition if compression is enabled. But did it work with FF ?

Posted by imad77, 04-21-2009, 09:59 PM
Hi, How can I disable the compression in Linux? I tried to open these files directly in the server via a MOzilla and I get the same issue. What do you mean by FF? Thanks a lot

Was this answer helpful?

 Print this Article

Also Read

How do I stop /tmp directory hacks?

Posted by tnedator, 06-19-2008, 04:03 PMI'm on a Cpanel/WHM (latest release version) VPS with...

php script security issues

Posted by CleverWebHost, 09-15-2008, 01:12 PMi am on a shared server with php script security...

favicon question

Posted by robertk1, 01-07-2008, 07:22 PMNot sure if this is the right forum, if not apologies.......

How to backup database (cpanel server)

Posted by hbhb, 01-13-2008, 09:19 PMHi, I have a crucial database (mysql). My server is running...

how to get multiple form values as variables in PHP?

Posted by SoftDux, 03-06-2010, 01:21 PMHi, Can someone please help me with this? I have a...