1

I have a file (*.lwxl) that I would like for users to download a file, but the mime-type is text/html, and I would like to change it to application. Is there any way to do this?

GSto
  • 41,512
  • 37
  • 133
  • 184

5 Answers5

4

If you have access to your Apache configuration (if you don't want to write a PHP script that will send the headers and the file content), maybe the AddType directive can help you :

The AddType directive maps the given filename extensions onto the specified content type. MIME-type is the MIME type to use for filenames containing extension. [...] This directive can be used to add mappings not listed in the MIME types file

The given example looks like this :

AddType image/gif .gif 
Pascal MARTIN
  • 395,085
  • 80
  • 655
  • 663
2

Add the appropriate mime type to the .htaccess file.

AddType application/x-lwxl .lwxl
ElephantHunter
  • 1,552
  • 1
  • 11
  • 15
1

You will need to set the mime type using a scripting language. Here is how to do it in PHP.

Mime-type of downloading file

Community
  • 1
  • 1
dbasch
  • 1,698
  • 1
  • 15
  • 31
  • this can only work if you are editing the file itself. I'm looking for a way to it externally. – GSto Sep 23 '09 at 21:05
0

You can't do that from PHP - you should do it through your Apache (or IIS or...) config.

For Apache you can edit your mime.types file:

application/lwxl-type lwxl
Greg
  • 316,276
  • 54
  • 369
  • 333
  • Why could you not serve a file from PHP, and set content header? – Zed Sep 23 '09 at 17:40
  • Well you could use mod_rewrite to send the request to a PHP file but that seems like a long way around – Greg Sep 23 '09 at 19:22
0

is that apache? http://httpd.apache.org/docs/2.2/mod/mod_mime.html check AddType Directive

golemwashere
  • 159
  • 1
  • 7