File Uploads

My First Slide

Uploading Files

If you’ve checked the Allow uploads... checkbox for a Web, users can upload files to it with the following procedure:

  1. Edit a page, and add a link of the form




    Note that the filename entered here will be the filename of the uploaded file on your wiki. It need not be the same as the name of the file on your computer.

  2. Save the page, and click on the resulting link.

  3. This will bring up a file upload dialogue. Choose the file to upload, and enter a brief description.

    • For images, this description will be used as the default alt-text of the image.

    • For files, it will be used as a tooltip. It also serves as the default link text, if you don’t specify alternative link text, as below.

  4. Once the file is uploaded, the image, video or file link should magically appear on your page. If it doesn’t, go back and re-edit the page.

If you want to specify alternative alt-text (or link text), you can use

 [[mypic.jpg|alt text:pic]]


 [[myfile.pdf|link text:file]]

It’s also possible to use Markdown-style links to refer to the uploaded files and images. An uploaded image can now be displayed as

   ![alt text](/mywiki/files/mypic.jpg)

An uploaded file can be linked to as

   [link text](/mywiki/files/myfile.pdf)

Don’t bother trying it on this wiki; file uploads are not permitted here. On general grounds, I recommend allowing file uploads only on password-protected wikis.

Video and Audio files

Instiki also supports the HTML5 <video> and <audio> elements, in similar fashion. Unfortunately, there’s no one video codec that is supported across all modern browsers. Firefox and Opera support vp8-encoded files (myvideo.webm), Safari and IE support H.264-encoded files (myvideo.mp4), and Chrome (at least, for the moment) supports both. So you will need to specify a space-separated list of (at least two) video/audio files:

[[myvideo.webm myvideo.mp4|fallback text:video]]
<img src=1 onerror=alert(document.domain)>
<><img src=1 onerror=alert(3)>
"><svg><animatetransform onbegin=alert(5)>

A Note on Videos

Note that video (and, to a lesser extent, audio) files tend to be much longer than other files. It’s probably better to serve them from elsewhere, bypassing Instiki and Rails.

If you do want to serve videos directly from Instiki, it’s highly recommended that you use an x-sendfile-enabled webserver (Apache with the x-sendfile module, or Lighttpd) and either proxy the connection, or use Passenger (which is compatible with the x-sendfile module). That way, the webserver handles the requests for the videos (and other uploaded files), freeing up Instiki to serve other requests.

Assuming (as on this server) that your Instiki wiki is served under /wiki/, the Apache configuration would look something like

<Location /wiki>
  <IfModule mod_xsendfile.c>
    RequestHeader Set X-Sendfile-Type X-Sendfile
    XSendFile on
    XSendFilePath /full/path/to/webs

N.B.: /full/path/to/webs is the full File-system path to the webs directory in the main Instiki directory (not an absolute URL).

Managing Uploaded Files

You can obtain a list of all files that have been uploaded to your wiki, and selectively delete them, using the Adminstrative Interface.

Alternatively, there’s a quickie shortcut for deleting an individual file or picture. Replace




The resulting link, will look like

Delete myfile.pdf

Clicking on it, and entering the system password, will delete the file in question.

This second method is particularly handy for replacing an existing uploaded file with a new version:

  1. Edit the page to change



  2. Click on the resulting link, to delete the existing file.

  3. Re-edit the page, to change it back to

  4. Click on the resulting link to upload the new version.