[Typo3] VCD_archive - how to force download

Martin Rud rudi at rudekuvert.dk
Thu Mar 10 22:12:41 CET 2005


Hi...

For the second time today I found the solution... ;o)

In class.tx_vcdarchive_pi1_fileOutput.php line 93:
   header("Content-Disposition: inline; filename=".basename($file));

chanhe it to:
   header("Content-Disposition: attachment; filename=".basename($file));

It works, at least, for pdf-files.

:o)

Martin Rud wrote:
> Hi
> 
> In another context I have made scriptthat does the work (se below). But 
> now that I work with TYPO3 I hope it can work here too... :o)
> 
> (I guess that: header("Content-Type: application/force-download"); does 
> the "job"...)
> 
> 
> <------------- snippet ------------------------>
> // Send the general header
> if (eregi("IE 5",$HTTP_USER_AGENT)) { $msie5 = 1; }
> 
> header ("Expires: Mon, 10 Dec 2001 08:00:00 GMT");
> header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
> if ($HTTP_SERVER_VARS['HTTPS'] != 'on') {
>   if($msie5){
>      // IE cannot download from sessions without a cache
>     header ('Cache-Control: public');
>   } else {
>     header ("Cache-Control: must-revalidate, post-check=0, pre-check=0");
>     // header ("Cache-Control: no-cache, must-revalidate");
>     header ("Pragma: no-cache");
>   }
> } else {
>    // for SSL connections you have to replace the two previous lines with
>    header ("Cache-Control: must-revalidate, post-check=0,pre-check=0");
>    header ("Pragma: public");
> }
> 
> header("Content-Type: application/force-download");
> header ("Content-Length: " . filesize($file));
> header ("Content-Disposition: attachment; filename=\"$filename\"");
> readfile($file);
> exit();
> 
> </---------------- snippet ------------------------>
> 
> Robert Markula wrote:
> 
>> Martin Rud wrote:
>>
>>> Hi
>>>
>>> With my installation of VDC Archive some file types (pdf, for 
>>> instance) opens inline (that is, in the browser window).
>>>
>>> I would like to avoid that.
>>>
>>> I prefer to make VCD force download (i.e. that the browser asks the 
>>> user to "Save as" or "Open" the file). Is it possible to set VCD to 
>>> force download when the user clicks on a file?
>>
>>
>>
>> I may be wrong, but as far as I know, this is a behaviour of the 
>> webbrowser, not the webserver. The only way to force a download is 
>> (again, as far as I know ;)) to zip the file or make some dirty 
>> filename tricks (e.g. use abc.pdf_ instead of abc.pdf).
>>
>> Hopefully somebody has better news...
>>
>> Ro



More information about the TYPO3-english mailing list