cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geert Josten" <geert.jos...@daidalos.nl>
Subject RE: link to a file
Date Wed, 27 Sep 2006 18:20:16 GMT
> >2de question; I want the user to download the file, that 
> when teh user 
> >cliks the link, his browser opens a download dialog box so heb can 
> >choose where to save the file.
> >
> >how do I do that?
> 
> To a large extent, that depends on the browser they're using 
> - for example, I have mine set to automatically download 
> files to a specific folder without prompting.
> 
> More generally, though, if the browser has a plugin that can 
> handle the returned mime type it will open it in that; 
> otherwise it will download it.  
> There may also be a separate "download this link" option on 
> the RMB popup menu to allow it to be saved rather than opened.
> If you want to force files to be downloaded rather than 
> handled by plugins, you could return application/octet-stream 
> as the mime type instead of the actual value.

I use the following strategy, which should work for most browsers I
believe:

	<map:match pattern="download/*">
        <map:act type="set-header">
          <map:parameter name="Content-Type"
value="application/x-download"/>
          <map:parameter name="Content-Disposition" value="attachment ;
filename={1}"/>

          <map:read src="{global:datadir}{1}" />
        </map:act>
	</map:match>

PS: {global:datadir} refers to a datadir element in
map:pipelines/map:component-configurations/global-variables

Kind regards,
Geert
   
 
Drs. G.P.H. Josten
Consultant
 
 

Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665  JZ  Bleiswijk
Tel.: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
www.daidalos.nl
KvK 27164984


De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is
uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen,
verzoeken wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message