1 rizwank 1.1 %META:TOPICINFO{author="PeterThoeny" date="1084053156" format="1.0" version="1.13"}%
2 %TOC%
3 %STARTINCLUDE%
4 ---# File Attachments
5
6 _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._
7
8 ---++ What Are Attachments Good For?
9
10 File Attachments can be used to create powerful customized groupware solutions, like file sharing and document management systems, and quick Web page authoring.
11
12 ---+++ Document Management System
13
14 * 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 [[#AttachmentAccess][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.
15
16 ---+++ File Sharing
17
18 * For file sharing, FileAttachments 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!
19
20 ---+++ Web Authoring
21
22 rizwank 1.1 * 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.
23 * __NOTE:__ You can also add graphics - any files - directly, typically by FTP upload. This requires FTP access, and may be more convenient if you have a large number of files to load. FTP-ed files can't be managed using browser-based Attachment controls. You can use your browser to create TWikiVariables shortcuts, like this %<nop>H% = %H%.
24
25 ---++ Uploading Files
26
27 * 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 [[#FileAttachmentTable][File Attachment table]].
28 * __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.
29 * 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.
30 * 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.
31 * TWiki can limit the file size. This is defined by the =%<nop>ATTACHFILESIZELIMIT%= variable of the TWikiPreferences, currently set at %ATTACHFILESIZELIMIT% KB.
32 * %X% 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.
33
34 ---++ Downloading Files
35
36 * Click on the file in the [[#FileAttachmentTable][File Attachment table]].
37 #AttachmentAccess
38
39 * %X% _NOTE:_ There is no access control on individual attachments. If you need control over single files, create a separate topic per file and set topic-level [[TWikiDocumentation#TWikiAccessControl][access restrictions]] for each.
40
41 ---++ Moving Attachment Files
42
43 rizwank 1.1 An attachment can be moved between topics.
44 * Click ==Manage== on the Attachment to be moved.
45 * On the control screen, select the new web and/or topic.
46 * Click ==Move==. The attachment and its version history are moved. The original location is stored as [[TWikiDocumentation#Meta_Data_Definition][topic Meta Data]].
47
48 ---++ Deleting Attachments
49
50 Move unwanted Attachments to web =Trash=, topic =TrashAttachment=.
51
52 ---++ Linking to Attached Files
53
54 * Once a file is attached it can be referenced in the topic. Example:
55 1. ==Attach== file: =Sample.txt=
56 1. ==Edit== topic and enter: =%<nop>ATTACHURL%/Sample.txt=
57 1. ==Preview==: =%<nop>ATTACHURL%/Sample.txt= text appears as: %PUBURL%/%WEB%/%TOPIC%/Sample.txt, a link to the text file.
58
59 * To reference an attachment located in another topic, enter:
60 * =%<nop>PUBURL%/%<nop>WEB%/OtherTopic/Sample.txt= (if it's within the same web)
61 * =%<nop>PUBURL%/Otherweb/OtherTopic/Sample.txt= (if it's in a different web)
62
63 * Attached HTML files and text files can be inlined in a topic. Example:
64 rizwank 1.1 1. ==Attach== file: =Sample.txt=
65 1. ==Edit== topic and write text: =%<nop>INCLUDE{"%<nop>ATTACHURL%/Sample.txt"}%=
66 * Content of attached file is shown inlined.
67 * Read more in IncludeTopicsAndWebPages.
68
69 * GIF, JPG and PNG images can be attached and shown embedded in a topic. Example:
70 1. ==Attach== file: =Smile.gif=
71 1. ==Edit== topic and write text: =%<nop>ATTACHURL%/Smile.gif=
72 1. ==Preview==: text appears as %PUBURL%/%WEB%/%TOPIC%/Smile.gif, an image.
73
74 #FileAttachmentTable
75 ---++ File Attachment Contents Table
76
77 Files attached to a topic are displayed in a directory table, displayed at the bottom of the page, or optionally, hidden and accessed when you click *Attach*.
78
79 <blockquote style="background-color:#f0f0f0">
80 <table border="1" cellspacing="0" cellpadding="20" width="90%"><tr><td>
81 <table border="1" cellspacing="0" cellpadding="1">
82 <tr><th align="center" bgcolor="#99CCCC"> <strong><a href="FileAttachment">Attachment</a></strong> </th><th align="center" bgcolor="#99CCCC"> <strong>Action</strong> </th><th align="center" bgcolor="#99CCCC"> <strong>Size</strong> </th><th align="center" bgcolor="#99CCCC"> <strong>Date</strong> </th><th align="center" bgcolor="#99CCCC"> <strong>Who</strong> </th><th align="center" bgcolor="#99CCCC"> <strong>Comment</strong> </th></tr>
83 <tr><td> <img src="%PUBURLPATH%/icn/txt.gif" width="16" height="16" align="top" /> <a href="%SCRIPTURLPATH%/viewfile%SCRIPTSUFFIX%/%WEB%/%TOPIC%?rev=&filename=Sample.txt">Sample.txt</a> </td><td> <a href="%SCRIPTURLPATH%/attach%SCRIPTSUFFIX%/%WEB%/%TOPIC%?filename=Sample.txt&revInfo=1">manage</a> </td><td align="right"> 0.1 K </td><td> 22 Jul 2000 - 19:37 </td><td> <a href="PeterThoeny">PeterThoeny</a> </td><td> Just a sample </td></tr>
84 <tr><td> <img src="%PUBURLPATH%/icn/bmp.gif" width="16" hight="16" align="top" /> <a href="%SCRIPTURLPATH%/viewfile%SCRIPTSUFFIX%/%WEB%/%TOPIC%?rev=&filename=Smile.gif">Smile.gif</a> </td><td> <a href="%SCRIPTURLPATH%/attach%SCRIPTSUFFIX%/%WEB%/%TOPIC%?filename=Smile.gif&revInfo=1">manage</a> </td><td align="right"> 0.1 K </td><td> 22 Jul 2000 - 19:38 </td><td> <a href="PeterThoeny">PeterThoeny</a> </td><td> Smiley face </td></tr>
85 rizwank 1.1 </table>
86 </td></tr></table>
87 </blockquote>
88
89 ---++ File Attachment Controls
90
91 Clicking on a ==Manage== link takes you to a new page that looks like this:
92
93 <blockquote style="background-color:#f0f0f0">
94 <form>
95 <table border="1" cellspacing="0" cellpadding="20"><tr><td>
96 <table border="1" cellspacing="0" cellpadding="1"> <tr><th align="center" bgcolor="#99CCCC"> <strong><a href="FileAttachment">Attachment</a></strong> </th><th align="center" bgcolor="#99CCCC"> <strong>Action</strong> </th><th align="center" bgcolor="#99CCCC"> <strong>Size</strong> </th><th align="center" bgcolor="#99CCCC"> <strong>Date</strong> </th><th align="center" bgcolor="#99CCCC"> <strong>Who</strong> </th><th align="center" bgcolor="#99CCCC"> <strong>Comment</strong> </th><th align="center" bgcolor="#99CCCC"> <strong><a href="FileAttribute">Attribute</a></strong> </th></tr>
97 <tr><td> <img src="%PUBURLPATH%/icn/txt.gif" width="16" height="16" align="top" /> <a href="%SCRIPTURLPATH%/viewfile%SCRIPTSUFFIX%/TWiki/%WEB%/%TOPIC%?rev=&filename=Sample.txt">Sample.txt</a> </td><td> <a href="%SCRIPTURLPATH%/attach%SCRIPTSUFFIX%/%WEB%/%TOPIC%?filename=Sample.txt&revInfo=1">manage</a> </td><td align="right"> 0.1 K </td><td> 22 Jul 2000 - 19:37 </td><td> <a href="PeterThoeny">PeterThoeny</a> </td><td> Just a sample </td><td align="center"> </td></tr>
98 <tr><td> <img src="%PUBURLPATH%/icn/bmp.gif" width="16" height="16" align="top" /> <a href="%SCRIPTURLPATH%/viewfile%SCRIPTSUFFIX%/%WEB%/%TOPIC%?rev=&filename=Smile.gif">Smile.gif</a> </td><td> <a href="%SCRIPTURLPATH%/attach%SCRIPTSUFFIX%/%WEB%/%TOPIC%?filename=Smile.gif&revInfo=1">manage</a> </td><td align="right"> 0.1 K </td><td> 22 Jul 2000 - 19:38 </td><td> <a href="PeterThoeny">PeterThoeny</a> </td><td> Smiley face </td><td align="center"> </td></tr>
99 </table>
100
101 <nop><h2>Update attachment <code>Sample.txt</code></h2>
102
103 <table border="1" cellspacing="0" cellpadding="1"> <tr><th align="center" bgcolor="#99CCCC"> <strong>Version</strong> </th><th align="center" bgcolor="#99CCCC"> <strong>Action</strong> </th><th align="center" bgcolor="#99CCCC"> <strong>Date</strong> </th><th align="center" bgcolor="#99CCCC"> <strong>Who</strong> </th><th align="center" bgcolor="#99CCCC"> <strong>Comment</strong> </th></tr>
104 <tr><td> 1.1 </td><td> <a href="%SCRIPTURLPATH%/viewfile%SCRIPTSUFFIX%/%WEB%/%TOPIC%?rev=1.1&filename=Sample.txt">view</a> </td><td> 2001.08.30.09.28.56 </td><td> <a href="PeterThoeny">PeterThoeny</a> </td><td> </td></tr>
105 </table>
106 rizwank 1.1 <p />
107 <table width="100%">
108 <tr>
109 <td align="right">
110 Previous <br /> upload:
111 </td><td>
112 <code>C:\DATA\Sample.txt</code> (<a href="PeterThoeny">PeterThoeny</a>)
113 </td>
114 </tr>
115 <tr>
116 <td align="right">
117 Local file:
118 </td><td>
119 <input type="hidden" name="filename" value="Sample.txt" />
120 <input type="file" name="filepath" value="C:\DATA\Sample.txt" size="50" />
121 </td>
122 </tr>
123 <tr>
124 <td align="right">
125 Comment:
126 </td><td>
127 rizwank 1.1 <input type="text" name="filecomment" value="Just a sample" maxlength="50" size="50" />
128 </td>
129 </tr>
130 <tr>
131 <td align="right">
132 Link:
133 </td><td>
134 <input type="checkbox" name="createlink" /> Create a link to the attached file at the end of the topic.
135 </td>
136 </tr>
137 <tr>
138 <td align="right">
139 Hide file:
140 </td><td>
141 <input type="checkbox" name="hidefile" /> Hide attachment in normal topic view.
142 </td>
143 </tr>
144 </table>
145 _Help text ..._
146
147 Topic <b>FileAttachment</b> . { <input type="submit" value=" Upload file " /> |
148 rizwank 1.1 <input type="submit" name="changeproperties" value="Change properties" /> |
149 <a href="%SCRIPTURLPATH%/rename%SCRIPTSUFFIX%/%WEB%/%TOPIC%?attachment=Sample.txt">Move attachment</a> |
150 <a href="FileAttachment">Cancel</a> }
151 </td></tr></table>
152 </form>
153 </blockquote>
154
155 * The first table is a list of all attachments, including their attributes. An =h= means the attachment is hidden, it isn't listed when viewing a topic.
156
157 * The second table is all the versions of the attachment. Click on *View* to see that version. If it's the most recent version, you'll be taken to an URL that always displays the latest version, which is usually what you want.
158 * *To change the comment* on an attachment, enter a new comment and then click *Change properties*. Note that the comment listed against the specific version will not change, however the comment displayed when viewing the topic does change.
159 * *To hide/unhide* an attachment, enable the ==Hide file== checkbox, then click ==Change properties==.
160
161 ---++ Known Issues
162
163 * Unlike topics, attachments are not locked during editing. As a workaround, you can change the comment to indicate an attachment file is being worked on - the comment on the specific version isn't lost, it's there when you list all versions of the attachment.
164
165 %STOPINCLUDE%
166
167 %META:FILEATTACHMENT{name="Sample.txt" attr="" comment="Just a sample" date="964294620" path="C:\DATA\Sample.txt" size="30" user="thoeny" version=""}%
168 %META:FILEATTACHMENT{name="Smile.gif" attr="" comment="Smiley face" date="964294680" path="C:\DATA\Smile.gif" size="94" user="thoeny" version=""}%
|