Click to See Complete Forum and Search --> : Controlling URN for RAW Data


Anon
11-08-2000, 06:23 PM
Here's one that'll stump you experts!

I have a PHP page that decodes a mail attatchment and outputs the file as raw binary data through the HTTP port. I want to be able to control the filename that is supposed to be downloaded, but no matter what I do the browser always thinks it is downloading the PHP file itself. Does anyone know a way to change the URN on the fly? Isn't there something like a "Content-Filename=whatever.zip" header field I could use?

Suggestions would be welcome.

--Dre

Anon
11-08-2000, 07:16 PM
I finally figured it out. By pouring over the W3C HTTP 1.1 specs for hours, I found what I needed in the appendix (of all places). I was on the right track thinking there was a header field to control default filenames:

header("Content-Disposition: attachment; filename=\"$filename\"");

I hope this is useful to someone else...


--Dre