hi, I'm not sure if I'm doing something wrong but I can't figure out how to get a download link for uploaded attachments. I'd like to be able to upload arbitrary attachments eg. settings.xml or .gitinore or setup.txt or stuff.zip and be able to add a link to the wiki page which should let the user instantly download that file. I thought it might be as simple as adding a directive eg. [[!downloadlink .gitinore]] .

This is driving me nuts, so any help or pointers will be appreciated even if I have to dig in to write a plugin. I'm running the 3.20100815.9 on Debian 6.0 but then also tried a manual install of 3.20130904.1 which seemed to have caused a bunch of timeout errors and not much improvement on the attachment issue. Should I try the git version?

thanks marius

Did I post it at the right place?

thanks

Comment by Marius Mon Oct 14 06:59:47 2013

It should be as simple as putting the attachment's name in double square brackets, like [[stuff.zip]]? There isn't really any difference between a download link and any other link.

(Or if it's attached to a different page, follow the same linkingrules as for pages, e.g. you might write [[sandbox/stuff.zip]] for a file attached to the sandbox.)

Comment by smcv Tue Oct 15 15:48:15 2013

?setup.txt - opens the plain text in the same browser window ?settings.xml - opens the formatted xml as html i.e. I can't right click and save as, I have to copy the text, create an empty file and paste it in ?.gitignore - it does not recognise this file, I have to rename it to gitignore.txt and explain to the user to rename it.

What I would like is a way to consistently get a dialog that asks the user where to save the file with the correct default file name.. I've recently figured out how to do this with javascript - it's a bit messy but it works: http://stackoverflow.com/a/11486284/381083

thanks

Comment by Marius Fri Oct 18 08:03:26 2013

?setup.txt - opens the plain text in the same browser window

That's the browser's choice: the web server says "this is text/plain" and the browser decides to display it in the window. IkiWiki doesn't actually serve the file, just provides a link to it; to force it to be downloaded rather than opened, you'd have to configure your web server to offer it as "Content-Disposition: attachment" (e.g. http://www.jtricks.com/bits/content_disposition.html).

The only way IkiWiki could get involved in this would be to have the file download go via the CGI script, which could add that header. That isn't currently a feature it has; you could maybe add a plugin if you need this?

?settings.xml - opens the formatted xml as html

Again, this is between the web server and the browser.

?.gitignore - it does not recognise this file

IkiWiki excludes files related to the source code control systems it uses, in order to avoid accidentally publishing a .gitignore that's intended to control ignored files for the git repo containing the pages' source. This is controlled by the wiki_file_prune_regexps, exclude and include config options. You can put .gitignore in include if you need to publish files with that name.

Comment by smcv Fri Oct 18 12:56:09 2013