Re: forcing download instead of showing output
| From: | Christian Dechery | Date: | Wed, 09 May 2001 01:39:30 +0000 |
| Subject: | Re: forcing download instead of showing output | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-52009@lists.php.net to get a copy of this message | ||
At 16:53 8/5/2001 -0400, Toby Miller wrote:
I use this code: header("Content-Type: $filetype"); header("Content-Disposition: atachment; filename=$showfilename"); header("Content-Length: $filesize"); readfile($source); Note the mispelling of "atachment". This seems wrong but is actually the correct spelling for IE, Netscape doesn't seem to mind either way.tried that... didn't work... all it did was tried to save the file being displayed (the form) to script.html.. I'm going to explain a little better what my script does, so it's easier to help me. there is a form with only one field... a file field... than the user selects the file, clicks on submit, by doing this, the file is uploaded and processed... it's a CSV file, that has to be checked and processed and return another CSV file with a specific filename (in my case $filename="003".date("dmy").".txt";)... so what I really want is the user to download this file with the processed content from the uploaded file... Do I really have to create this file with fopen() or something and only then put the headers? In this case I'd have a file that I don't want... I'd have to delete it later on, isn't there a way I can just redirect all the output generated by php to a download and instruct the browser the filename to be saved? Where can I get some reference to all this header stuff? thanks ____________________________ . Christian Dechery (lemming) . http://www.tanamesa.com.br . Gaita-L Owner / Web Developer