From: Roel Croonenberghs <[EMAIL PROTECTED]>
Date: Tue, 26 Sep 2006 17:02:23 +0200

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.


Andrew.





"Andrew Stevens" <[EMAIL PROTECTED]>
26/09/2006 16:23
Please respond to
[email protected]


To
[email protected]
cc

Subject
RE: link to a file






>From: Roel Croonenberghs <[EMAIL PROTECTED]>
>Date: Tue, 26 Sep 2006 16:12:28 +0200
>
>Hello,
>
>I have a dir in my WEB_INF folder where users can upload there files.
That
>works. But I want these files to be available for download. so I use a
>directory generator;
><map:generate type="directory" src="\WEB-INF\files\download">
>
>and I transform the result via xsl to produce a html with the links to
>these files.
>
>But what should I put in the href"" tag of a file? Because instead of
>letting the user download the file, cocoon tries to resolve the url in
the
>sitemap.

Well, if they're under WEB-INF you won't be able to link directly to them
anyway since the spec says web containers shouldn't serve up files under
there.  You don't say what URL you're matching on to get the directory
listing, but assuming it's something like <map:match pattern="mydir"> then

you could just use relative links in the generated hrefs and add
<map:match pattern="mydir/*">
<map:read src="\WEB-INF\files\download\{1}"/>
</map:match>
to your sitemap.  Depending on the filetypes you may also need to match
based on the extension and supply the relevant mime-type attributes on the

map:read elements.


Andrew.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to