Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

add file extension

Status
Not open for further replies.

imad77

Instructor
Oct 18, 2008
97
CA
Hi,

I run a script from a Web page to download a file, this Perl script and these files to download are located in Linux server. When I click on the link of the file to download from a Windows station via this Web page , 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 ".xml", the dialog box ask me to save it only and I have not an "Open" button.


How can I add these extensions (.dat and .xml) to my script to be able to open it with Textpad or Notepad?
I added these lines in this file: /etc/mime.types

text/plain asc txt dat

I added these lines in this file: /etc/httpd/conf/httpd.conf

AddType text/plain .asc .txt .dat

But it does not work fine.

Can someone help me to fix this issue?


Thanks

Imad77
 
Hi

If the browser not offers the possibility to Open, then the browser has to be configured.

But of course, knowing more about the sent HTTP response headers may dim some light on other problem.

To find out what HTTP headers are accompanying the sent file use a suitable tool :
[ul]
[li]Browser:
[ul]
[li]FireFox:
[ul]
[li]Live HTTP Headers[/li]
[li]FireBug[/li]
[li]Web Developer[/li]
[/ul]
[/li]
[li]Lynx[/li]
[li]Links[/li]
[li]W3M[/li]
[li]Explorer:
[ul]
[li]ieHTTPHeaders[/li]
[li]IEWatch[/li]
[/ul]
[/li]
[/ul]
[/li]
[li]tool:
[ul]
[li][tt]netcat[/tt][/li]
[li]PuTTY[/li]
[li][tt]telnet[/tt][/li]
[li][tt]Wget[/tt][/li]
[/ul]
[/li]
[/ul]

Feherke.
 
Hi, Imad77

I think the problem is Windows does not have an application associated with those file extensions. By this I mean there is no standard program to be used in Windows to handle .dat or .xml files.

When there is no program defined, windows browsers only give the save option.

To overcome this, save a file of each type on the Windows system, then open Windows Explorer (not Internet Explorer), locate the file and right click on it. In the menu that results point to "open with" and click on "choose program".
In the dialog pick the program you want to use to open these files (such as notepad), select it, put a checkmark in "always use this program" and click on OK.

Note some terminology may differ depending which version of Windows (and of course which language).

Then in the future you will get both the open and save options in the browser.

Jock
 
Hi,

Can I perform it from Apache in the server? because I cannot change it in the stations.

Thanks
 
Hi, Imad77

Not that I know of, unless you have some means of pushing a group policy down to the windows stations to configure them, and I don't know any way to do that in Apache myself.

Alternatively, it would be possible to put a .reg file on the server with the appropriate registry entries to update the registries on the windows stations. But for that to work the windows users would have to open the .reg file and they would have to have sufficient rights on their local machine to allow registry updates. Many corporate environments do not allow this.

Jock

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top