File Attachments
Each topic can have one or more files of any type attached to it by using the Attach screen to upload (or download) files from your local PC. Attachments are stored under revision control: uploads are automatically backed up; all previous versions of a modified file can be retrieved.
What Are Attachments Good For?
File Attachments can be used to archive data, or to create powerful customized groupware solutions, like file sharing and document management systems, and quick Web page authoring.
Document Management System
- You can use Attachments to store and retrieve documents (in any format, with associated graphics, and other media files); attach documents to specific TWiki topics; collaborate on documents with full revision control; distribute documents on a need-to-know basis using web and topic-level access control; create a central reference library that's easy to share with an user group spread around the world.
File Sharing
- For file sharing, File Attachments on a series of topics can be used to quickly create a well-documented, categorized digital download center for all types of files: documents; graphics and other media; drivers and patches; applications; anything you can safely upload!
Web Authoring
- Through your Web browser, you can easily upload graphics (or sound files, or anything else you want to link to on a page) and place them on a single page, or use them across a web, or site-wide.
Uploading Files
- Click on the
Attach
link at the bottom of the page. The Attach
screen lets you browse for a file, add a comment, and upload it. The uploaded file will show up in the File Attachment table at the bottom of the page.
- NOTE: The topic must already exist. It is a two step process if you want to attach a file to a non-existing topic; first create the topic, then add the file attachment.
- Any type of file can be uploaded. Some files that might pose a security risk are renamed, ex:
*.php
files are renamed to *.php.txt
so that no one can place code that would be read in a .php file.
- The previous upload path is retained for convenience. In case you make some changes to the local file and want to upload it, again you can copy the previous upload path into the Local file field.
- TWiki can limit the file size. This is defined by the
%ATTACHFILESIZELIMIT%
variable of the TWiki Preferences, currently set at 10000 KB.
- It's not recommended to upload files greater than a few hundred K through a browser. Large files can be extremely slow-loading, and often time out. Use an FTP site for large file uploads.
- Automatic attachments:
- When enabled, all files in a topic's attachment directory are shown as attachments to the topic - even if they were directly copied to the directory and never attached by using an 'Attach' link. This is a convenient way to quickly "attach" files to a topic without uploading them one by one; although at the cost of losing audit trail and version control.
- To enable this feature, set the {AutoAttachPubDir} configuration option.
- NOTE: The automatic attachment feature can only be used by an administrator who has access to the server's file system.
Downloading Files
- Click on the file in the File Attachment table.
Moving Attachment Files
An attachment can be moved between topics.
- Click
Manage
on the Attachment to be moved.
- On the control screen, select the new web and/or topic.
- Click
Move
. The attachment and its version history are moved.
Deleting Attachments
Move unwanted Attachments to web
Trash
, topic
TrashAttachment
.
Linking to Attached Files
- Once a file is attached it can be referenced in the topic. Example:
-
Attach
file: Sample.txt
-
Edit
topic and enter: %ATTACHURL%/Sample.txt
-
Preview
: %ATTACHURL%/Sample.txt
text appears as: /twiki/pub/Memories/FileAttachment/Sample.txt, a link to the text file.
- To reference an attachment located in another topic, enter:
-
%PUBURLPATH%/%WEB%/OtherTopic/Sample.txt
(if it's within the same web)
-
%PUBURLPATH%/Otherweb/OtherTopic/Sample.txt
(if it's in a different web)
- Attached HTML files and text files can be inlined in a topic. Example:
-
Attach
file: Sample.txt
-
Edit
topic and write text: %INCLUDE{"%ATTACHURL%/Sample.txt"}%
- Content of attached file is shown inlined.
- GIF, JPG and PNG images can be attached and shown embedded in a topic. Example:
-
Attach
file: Smile.gif
-
Edit
topic and write text: %ATTACHURL%/Smile.gif
-
Preview
: text appears as /twiki/pub/Memories/FileAttachment/Smile.gif, an image.