Re: Change the filename sent via html header
| From: | Frank M. Kromann | Date: | Tue, 03 Apr 2001 22:42:32 +0000 |
| Subject: | Re: Change the filename sent via html header | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-46907@lists.php.net to get a copy of this message | ||
You can use something like this:
<?PHP
$strMimeType = "image/gif"æ
$strName = "myfile.gif";
$iFileSize = filesize($strName);
Header("Content-Type: $strMimeType; name=\"$strName\"");
Header("Content-Length: $iFileSize";
Header("Content-Disposition: inline; filename=\"$strName\"");
readfile($strName);
?>
this will change the mime type and filename of the content send to the browser.
- Frank
> On 4/3/01 12:34 PM, "Spunk S. Spunk III" <spunk@mac.com> wrote:
>
> > I've got a script that returns a smil file in a header but I'd like to
> > change the name of the file. The file is sent as blah.php (even though it is
> > a smil file) but I'd like to be able to name it something like blah.sml. Is
> > there a way to do this?
> >
> > Spunk
> >
> If you are using include() to send the file in the header, then it doesn't
> matter WHAT the extension is. All files sent through include() are parsed as
> if they were PHP, with or without the php extension. So, as long as nothing
> in your smil file looks like php, then it will just get passed through (as
> if it were html).
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>
>