To use header to download a MS Word file, what would the content type be?
And would you use the size of the file in bytes for the "Content-Length" header?
header("Content-Type... for MS Word document
Moderator: General Moderators
- Bill H
- DevNet Resident
- Posts: 1136
- Joined: Sat Jun 01, 2002 10:16 am
- Location: San Diego CA
- Contact:
Thanks. This isn't actually client side since it deals with downloading a file from a server, but that was not clear in my post.
The documentation that I could find for Content-Type is spotty, and I wasn't getting this to work right.
Code: Select all
<?php
header("Content-Type: application/msword");
header("Content-Disposition: attachment; filename=$filename.doc");
readfile('$filename.doc');
?>there is no variable substitution within single quoted strings.readfile('$filename.doc');
try
Code: Select all
...
header('Content-length: '.filesize("$filename.doc"));
readfile("$filename.doc");-
fractalvibes
- Forum Contributor
- Posts: 335
- Joined: Thu Sep 26, 2002 6:14 pm
- Location: Waco, Texas
Look here:
ftp://ftp.isi.edu/in-notes/iana/assignm ... dia-types/
for a list of many different mime types.
Phil J.
ftp://ftp.isi.edu/in-notes/iana/assignm ... dia-types/
for a list of many different mime types.
Phil J.