Forum Moderators: phranque
I run a script from a Web page to download a file, this Perl/CGI script and these files to download are located in a Linux server. When I click on the link of the file to download from a Windows XP station 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.
How can I add these extensions (.dat, .xml and others) to Apache configuration 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 also: /etc/httpd/conf/httpd.conf
AddType text/plain .asc .txt .dat
But it does not work fine. I want to configure these MIME types in Apache to provide to a lot of users in the net to be able to open these files.
Can someone help me to fix this issue in the httpd.conf?
Thanks
Imad77
For example, in PERL:
print("Content-Type: text/plain\n\n");
Jim
I tried it but it opens all of the files (.doc, .xls, .csv, .ppt, ....) in Internet Explorer instead Notepad.
I want to be able to open the files with specified extension like .dat, .asc and I know that we can perform it from Microsoft IIS but I want to be able to add these extensions as MIME types in APache configuration file.
thanks
You can use the Live HTTP Headers add-on for Firefox/Mozilla browsers to see what headers your script is outputting. The results should show:
Content-Type: text/plain
Content-Disposition: attachment; filename=<your_filename_goes_here>
Content-Length: <number of bytes>
Jim