none
[openafs-wiki.git] / TWiki / FileAttachment.mdwn
1 <div>
2   <ul>
3     <li><a href="#File Attachments"> File Attachments</a><ul>
4         <li><a href="#What Are Attachments Good For?"> What Are Attachments Good For?</a><ul>
5             <li><a href="#Document Management System"> Document Management System</a></li>
6             <li><a href="#File Sharing"> File Sharing</a></li>
7             <li><a href="#Web Authoring"> Web Authoring</a></li>
8           </ul>
9         </li>
10         <li><a href="#Uploading Files"> Uploading Files</a></li>
11         <li><a href="#Downloading Files"> Downloading Files</a></li>
12         <li><a href="#Moving Attachment Files"> Moving Attachment Files</a></li>
13         <li><a href="#Deleting Attachments"> Deleting Attachments</a></li>
14         <li><a href="#Linking to Attached Files"> Linking to Attached Files</a></li>
15         <li><a href="#File Attachment Contents Table"> File Attachment Contents Table</a></li>
16         <li><a href="#File Attachment Controls"> File Attachment Controls</a></li>
17         <li><a href="#Known Issues"> Known Issues</a></li>
18       </ul>
19     </li>
20   </ul>
21 </div>
22
23 # <a name="File Attachments"></a> File Attachments
24
25 _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._
26
27 ## <a name="What Are Attachments Good For?"></a> What Are Attachments Good For?
28
29 File Attachments can be used to create powerful customized groupware solutions, like file sharing and document management systems, and quick Web page authoring.
30
31 ### <a name="Document Management System"></a> Document Management System
32
33 - 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|Main/WebHome#AttachmentAccess]] 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.
34
35 ### <a name="File Sharing"></a> File Sharing
36
37 - 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!
38
39 ### <a name="Web Authoring"></a> Web Authoring
40
41 - 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.
42   - **_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 %H% = %H%.
43
44 ## <a name="Uploading Files"></a> Uploading Files
45
46 - Click on the <code>**Attach**</code> 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|Main/WebHome#FileAttachmentTable]].
47   - 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.
48   - 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.
49   - TWiki can limit the file size. This is defined by the `%ATTACHFILESIZELIMIT%` variable of the [[TWikiPreferences]], currently set at %ATTACHFILESIZELIMIT% KB.
50     - %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.
51
52 ## <a name="Downloading Files"></a> Downloading Files
53
54 - Click on the file in the [[File Attachment table|Main/WebHome#FileAttachmentTable]].
55
56 <a name="AttachmentAccess"></a>
57
58 - %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 [[access restrictions|Main/TWikiDocumentation#TWikiAccessControl]] for each.
59
60 ## <a name="Moving Attachment Files"></a> Moving Attachment Files
61
62 An attachment can be moved between topics.
63
64 - Click <code>**Manage**</code> on the Attachment to be moved.
65 - On the control screen, select the new web and/or topic.
66 - Click <code>**Move**</code>. The attachment and its version history are moved. The original location is stored as [[topic Meta Data|Main/TWikiDocumentation#Meta_Data_Definition]].
67
68 ## <a name="Deleting Attachments"></a> Deleting Attachments
69
70 Move unwanted Attachments to web `Trash`, topic `TrashAttachment`.
71
72 ## <a name="Linking to Attached Files"></a> Linking to Attached Files
73
74 - Once a file is attached it can be referenced in the topic. Example:
75   1. <code>**Attach**</code> file: `Sample.txt`
76   2. <code>**Edit**</code> topic and enter: `%ATTACHURL%/Sample.txt`
77   3. <code>**Preview**</code>: `%ATTACHURL%/Sample.txt` text appears as: <http://www.dementia.org/twiki//view/%WEB%/%TOPIC%/Sample.txt>, a link to the text file.
78
79 - To reference an attachment located in another topic, enter:
80   - `%PUBURL%/%WEB%/OtherTopic/Sample.txt` (if it's within the same web)
81   - `%PUBURL%/Otherweb/OtherTopic/Sample.txt` (if it's in a different web)
82
83 - Attached HTML files and text files can be inlined in a topic. Example:
84   1. <code>**Attach**</code> file: `Sample.txt`
85   2. <code>**Edit**</code> topic and write text: `%INCLUDE{"%ATTACHURL%/Sample.txt"}%`
86     - Content of attached file is shown inlined.
87     - Read more in [[IncludeTopicsAndWebPages]].
88
89 - GIF, JPG and PNG images can be attached and shown embedded in a topic. Example:
90   1. <code>**Attach**</code> file: `Smile.gif`
91   2. <code>**Edit**</code> topic and write text: `%ATTACHURL%/Smile.gif`
92   3. <code>**Preview**</code>: text appears as ![Smile.gif](http://www.dementia.org/twiki//view/%WEB%/%TOPIC%/Smile.gif), an image.
93
94 <a name="FileAttachmentTable"></a>
95
96 ## <a name="File Attachment Contents Table"></a> File Attachment Contents Table
97
98 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**.
99
100 > <table border="1" cellpadding="20" cellspacing="0" width="90%">
101 >   <tr>
102 >     <td>
103 >       <table border="1" cellpadding="1" cellspacing="0">
104 >         <tr>
105 >           <th align="center" bgcolor="#99CCCC"><strong><a href="FileAttachment">Attachment</a></strong></th>
106 >           <th align="center" bgcolor="#99CCCC"><strong>Action</strong></th>
107 >           <th align="center" bgcolor="#99CCCC"><strong>Size</strong></th>
108 >           <th align="center" bgcolor="#99CCCC"><strong>Date</strong></th>
109 >           <th align="center" bgcolor="#99CCCC"><strong>Who</strong></th>
110 >           <th align="center" bgcolor="#99CCCC"><strong>Comment</strong></th>
111 >         </tr>
112 >         <tr>
113 >           <td><img align="top" height="16" src="http://www.dementia.org/twiki//view/icn/txt.gif" width="16" /> <a href="http://www.dementia.org/twiki//viewfile/%WEB%/%TOPIC%?rev=&filename=Sample.txt">Sample.txt</a></td>
114 >           <td><a href="http://www.dementia.org/twiki//attach/%WEB%/%TOPIC%?filename=Sample.txt&revInfo=1">manage</a></td>
115 >           <td align="right"> 0.1 K </td>
116 >           <td> 22 Jul 2000 - 19:37 </td>
117 >           <td><a href="PeterThoeny">PeterThoeny</a></td>
118 >           <td> Just a sample </td>
119 >         </tr>
120 >         <tr>
121 >           <td><img align="top" hight="16" src="http://www.dementia.org/twiki//view/icn/bmp.gif" width="16" /> <a href="http://www.dementia.org/twiki//viewfile/%WEB%/%TOPIC%?rev=&filename=Smile.gif">Smile.gif</a></td>
122 >           <td><a href="http://www.dementia.org/twiki//attach/%WEB%/%TOPIC%?filename=Smile.gif&revInfo=1">manage</a></td>
123 >           <td align="right"> 0.1 K </td>
124 >           <td> 22 Jul 2000 - 19:38 </td>
125 >           <td><a href="PeterThoeny">PeterThoeny</a></td>
126 >           <td> Smiley face </td>
127 >         </tr>
128 >       </table>
129 >     </td>
130 >   </tr>
131 > </table>
132
133 ## <a name="File Attachment Controls"></a> File Attachment Controls
134
135 Clicking on a <code>**Manage**</code> link takes you to a new page that looks like this:
136
137 > <form>
138 >   <table border="1" cellpadding="20" cellspacing="0">
139 >     <tr>
140 >       <td>
141 >         <table border="1" cellpadding="1" cellspacing="0">
142 >           <tr>
143 >             <th align="center" bgcolor="#99CCCC"><strong><a href="FileAttachment">Attachment</a></strong></th>
144 >             <th align="center" bgcolor="#99CCCC"><strong>Action</strong></th>
145 >             <th align="center" bgcolor="#99CCCC"><strong>Size</strong></th>
146 >             <th align="center" bgcolor="#99CCCC"><strong>Date</strong></th>
147 >             <th align="center" bgcolor="#99CCCC"><strong>Who</strong></th>
148 >             <th align="center" bgcolor="#99CCCC"><strong>Comment</strong></th>
149 >             <th align="center" bgcolor="#99CCCC"><strong><a href="FileAttribute">Attribute</a></strong></th>
150 >           </tr>
151 >           <tr>
152 >             <td><img align="top" height="16" src="http://www.dementia.org/twiki//view/icn/txt.gif" width="16" /> <a href="http://www.dementia.org/twiki//viewfile/TWiki/%WEB%/%TOPIC%?rev=&filename=Sample.txt">Sample.txt</a></td>
153 >             <td><a href="http://www.dementia.org/twiki//attach/%WEB%/%TOPIC%?filename=Sample.txt&revInfo=1">manage</a></td>
154 >             <td align="right"> 0.1 K </td>
155 >             <td> 22 Jul 2000 - 19:37 </td>
156 >             <td><a href="PeterThoeny">PeterThoeny</a></td>
157 >             <td> Just a sample </td>
158 >             <td align="center">   </td>
159 >           </tr>
160 >           <tr>
161 >             <td><img align="top" height="16" src="http://www.dementia.org/twiki//view/icn/bmp.gif" width="16" /> <a href="http://www.dementia.org/twiki//viewfile/%WEB%/%TOPIC%?rev=&filename=Smile.gif">Smile.gif</a></td>
162 >             <td><a href="http://www.dementia.org/twiki//attach/%WEB%/%TOPIC%?filename=Smile.gif&revInfo=1">manage</a></td>
163 >             <td align="right"> 0.1 K </td>
164 >             <td> 22 Jul 2000 - 19:38 </td>
165 >             <td><a href="PeterThoeny">PeterThoeny</a></td>
166 >             <td> Smiley face </td>
167 >             <td align="center">   </td>
168 >           </tr>
169 >         </table>
170 >         <p>
171 >         </p>
172 >         <h2>Update attachment <code>Sample.txt</code></h2>
173 >         <p>
174 >         </p>
175 >         <table border="1" cellpadding="1" cellspacing="0">
176 >           <tr>
177 >             <th align="center" bgcolor="#99CCCC"><strong>Version</strong></th>
178 >             <th align="center" bgcolor="#99CCCC"><strong>Action</strong></th>
179 >             <th align="center" bgcolor="#99CCCC"><strong>Date</strong></th>
180 >             <th align="center" bgcolor="#99CCCC"><strong>Who</strong></th>
181 >             <th align="center" bgcolor="#99CCCC"><strong>Comment</strong></th>
182 >           </tr>
183 >           <tr>
184 >             <td> 1.1 </td>
185 >             <td><a href="http://www.dementia.org/twiki//viewfile/%WEB%/%TOPIC%?rev=1.1&filename=Sample.txt">view</a></td>
186 >             <td> 2001.08.30.09.28.56 </td>
187 >             <td><a href="PeterThoeny">PeterThoeny</a></td>
188 >             <td>   </td>
189 >           </tr>
190 >         </table>
191 >         <p>
192 >         </p>
193 >         <table width="100%">
194 >           <tr>
195 >             <td align="right"> Previous <br /> upload: </td>
196 >             <td><code>C:\DATA\Sample.txt</code> (<a href="PeterThoeny">PeterThoeny</a>) </td>
197 >           </tr>
198 >           <tr>
199 >             <td align="right"> Local file: </td>
200 >             <td><input name="filename" type="hidden" value="Sample.txt" /> <input name="filepath" size="50" type="file" value="C:\DATA\Sample.txt" /></td>
201 >           </tr>
202 >           <tr>
203 >             <td align="right"> Comment: </td>
204 >             <td><input maxlength="50" name="filecomment" size="50" type="text" value="Just a sample" /></td>
205 >           </tr>
206 >           <tr>
207 >             <td align="right"> Link: </td>
208 >             <td><input name="createlink" type="checkbox" /> Create a link to the attached file at the end of the topic. </td>
209 >           </tr>
210 >           <tr>
211 >             <td align="right"> Hide file: </td>
212 >             <td><input name="hidefile" type="checkbox" /> Hide attachment in normal topic view. </td>
213 >           </tr>
214 >         </table><em>Help text ...</em><p> Topic <b>FileAttachment</b> . { </p><input type="submit" value="   Upload file   " /> | <input name="changeproperties" type="submit" value="Change properties" /> | <a href="http://www.dementia.org/twiki//rename/%WEB%/%TOPIC%?attachment=Sample.txt">Move attachment</a> | <a href="FileAttachment">Cancel</a> } </td>
215 >     </tr>
216 >   </table>
217 > </form>
218
219 - 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.
220
221 - 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.
222   - **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.
223   - **To hide/unhide** an attachment, enable the <code>**Hide file**</code> checkbox, then click <code>**Change properties**</code>.
224
225 ## <a name="Known Issues"></a> Known Issues
226
227 - 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.