Instiki
File Uploads

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

    [[mypic.jpg:pic]]

    or

    [[myfile.pdf:file]]

    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]]

or

 [[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]]

or

[[myaudio.mp3 myaudio.webm myaudio.ogg|fallback text:audio]]

You’ll then go through a process, similar to the one described above, to upload each of the audio/video files. Here, the optional “fallback text” is what a user of an older browser, which doesn’t support HTML5 audio/video will see.

Youtube Videos

With Instiki 0.19.8, you can embed Youtube videos using the following syntax:

[[pusX8MuWmbE:youtube]]

or (if you want to alter the size of the player)

[[pusX8MuWmbE| 640 x 390 :youtube]]

Either way, you get something that looks like this:

Wolfram CDF files

Wolfram Research has introduced a proprietary format called Computable Document Format, which essentially allows you to put interactive Mathematica notebooks on the web. With the aid of a free browser plugin, users can manipulate some data and see the results of the updated computation.

Instiki allows you to upload CDF files to the server, and display them on a wiki page. Thus

[[Voronoi.cdf| 588 x 380 :cdf]]

will (after uploading the file) display

where you can drag the anchor points around, change the colour scheme, etc.

The size attribute is optional (and defaults to 500x300):

[[MyDocument.cdf:cdf]]

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
  </IfModule>
</Location>

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

 [[myfile.pdf:file]]

with

 [[myfile.pdf:delete]]

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

     [[myfile.pdf:file]]

    to

     [[myfile.pdf:delete]]
  2. Click on the resulting link, to delete the existing file.

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

     [[myfile.pdf:file]]
  4. Click on the resulting link to upload the new version.