7758d83dd4e3a4302e58c557d4f5b23253e4463a
[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="#Page Content"> Page Content</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 Control Page"> File Attachment Control Page</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 files attached to it. This is similar to an e-mail attachment. Just use your browser to upload or download a file. Attachments are stored under revision control - no upload is lost.
26
27 ### <a name="What Are Attachments Good For?"></a> What Are Attachments Good For?
28
29 #### <a name="Document Management System"></a> Document Management System
30
31 - **_document management system: distribution, revision_**
32
33 #### <a name="File Sharing"></a> File Sharing
34
35 - **_share files: applications, data files; recommended for light use_**
36
37 #### <a name="Page Content"></a> Page Content
38
39 - **_on-site use: linking to graphics, docs_**
40
41 ### <a name="Uploading Files"></a> Uploading Files
42
43 - To upload: Click on the Attach link at the bottom of each page. A form is shown where you can browse for a file and upload it. The uploaded file will show up in the [[File Attachment table|Main/WebHome#FileAttachmentTable]].
44 - Files of any type can be uploaded. Some files that might impose a security risk are renamed, i.e. `*.php` files are renamed to `*.php.txt`.
45 - Currently there is no file size limit besides the disk space on the server.
46 - 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.
47
48 ### <a name="Downloading Files"></a> Downloading Files
49
50 - To download: Click on the file in the [[File Attachment table|Main/WebHome#FileAttachmentTable]].
51 - There is no access control on individual attachments. If you need to have this type of control create separate topics and define access restrictions on the topics.
52
53 ### <a name="Moving Attachment Files"></a> Moving Attachment Files
54
55 An attachement can be moved between topics. To do this click _action_ on the attachment to be moved. On the subsequent page select the new Web and Topic, the click _Move_. The attachment and its version history is moved. The original location is stored in the [[topic meta data|Main/TWikiDocumentation#Meta_Data_Definition]].
56
57 ### <a name="Deleting Attachments"></a> Deleting Attachments
58
59 It is not possible to delete attached files with the current TWiki implementation. However, they can be moved to another topic. You may care to have a topic **Trash.TrashAttachments** - move attachments that are no longer wanted here.
60
61 ### <a name="Linking to Attached Files"></a> Linking to Attached Files
62
63 - Once a file is attached it can be referenced in the topic. Example:
64   - Attach file: `Sample.txt`
65   - Edit topic and write text: `%ATTACHURL%/Sample.txt`
66   - Text is shown as: <http://www.dementia.org/twiki//view/%WEB%/%TOPIC%/Sample.txt>, ex: it is a link.
67   - To reference an attachment located in another topic write text:
68     - `%PUBURL%/%WEB%/OtherTopic/Sample.txt` (for same web)
69     - `%PUBURL%/Otherweb/OtherTopic/Sample.txt` (for different web)
70
71 - Attached HTML files and text files can be inlined in a topic. Example:
72   - Attach file: `Sample.txt`
73   - Edit topic and write text: `%INCLUDE{"%ATTACHURL%/Sample.txt"}%`
74   - Content of attached file is shown inlined.
75   - Read more in [[IncludeTopicsAndWebPages]].
76
77 - GIF, JPG and PNG images can be attached and shown embedded in a topic. Example:
78   - Attach file: `Smile.gif`
79   - Edit topic and write text: `%ATTACHURL%/Smile.gif`
80   - Text is shown as: ![Smile.gif](http://www.dementia.org/twiki//view/%WEB%/%TOPIC%/Smile.gif) , it shows up as an image.
81
82 <a name="FileAttachmentTable"></a>
83
84 ### <a name="File Attachment Contents Table"></a> File Attachment Contents Table
85
86 Is a table that looks like this:
87
88 <table border="1" cellpadding="20" cellspacing="0">
89   <tr>
90     <td>
91       <table border="1" cellpadding="1" cellspacing="0">
92         <tr>
93           <th align="center" bgcolor="#99CCCC"><strong><a href="FileAttachment">Attachment</a>:</strong></th>
94           <th align="center" bgcolor="#99CCCC"><strong>Action:</strong></th>
95           <th align="center" bgcolor="#99CCCC"><strong>Size:</strong></th>
96           <th align="center" bgcolor="#99CCCC"><strong>Date:</strong></th>
97           <th align="center" bgcolor="#99CCCC"><strong>Who:</strong></th>
98           <th align="center" bgcolor="#99CCCC"><strong>Comment:</strong></th>
99         </tr>
100         <tr>
101           <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/FileAttachment?rev=&filename=Sample.txt">Sample.txt</a></td>
102           <td><a href="http://www.dementia.org/twiki//attach/TWiki/FileAttachment?filename=Sample.txt&revInfo=1">action</a></td>
103           <td> 30 </td>
104           <td> 22 Jul 2000 - 19:37 </td>
105           <td><a href="PeterThoeny">PeterThoeny</a></td>
106           <td> Just a sample </td>
107         </tr>
108         <tr>
109           <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/TWiki/FileAttachment?rev=&filename=Smile.gif">Smile.gif</a></td>
110           <td><a href="http://www.dementia.org/twiki//attach/TWiki/FileAttachment?filename=Smile.gif&revInfo=1">action</a></td>
111           <td> 94 </td>
112           <td> 22 Jul 2000 - 19:38 </td>
113           <td><a href="PeterThoeny">PeterThoeny</a></td>
114           <td> Smiley face </td>
115         </tr>
116       </table>
117     </td>
118   </tr>
119 </table>
120
121 ### <a name="File Attachment Control Page"></a> File Attachment Control Page
122
123 Clicking on an action link takes you to a new page that looks like this:
124
125 <form>
126   <table border="1" cellpadding="20" cellspacing="0">
127     <tr>
128       <td>
129         <table border="1" cellpadding="1" cellspacing="0">
130           <tr>
131             <th align="center" bgcolor="#99CCCC"><strong><a href="FileAttachment">Attachment</a>:</strong></th>
132             <th align="center" bgcolor="#99CCCC"><strong>Action:</strong></th>
133             <th align="center" bgcolor="#99CCCC"><strong>Size:</strong></th>
134             <th align="center" bgcolor="#99CCCC"><strong>Date:</strong></th>
135             <th align="center" bgcolor="#99CCCC"><strong>Who:</strong></th>
136             <th align="center" bgcolor="#99CCCC"><strong>Comment:</strong></th>
137             <th align="center" bgcolor="#99CCCC"><strong><a href="FileAttribute">Attribute</a>:</strong></th>
138           </tr>
139           <tr>
140             <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/FileAttachment?rev=&filename=Sample.txt">Sample.txt</a></td>
141             <td><a href="http://www.dementia.org/twiki//attach/TWiki/FileAttachment?filename=Sample.txt&revInfo=1">action</a></td>
142             <td> 30 </td>
143             <td> 22 Jul 2000 - 19:37 </td>
144             <td><a href="PeterThoeny">PeterThoeny</a></td>
145             <td> Just a sample </td>
146             <td align="center">   </td>
147           </tr>
148           <tr>
149             <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/TWiki/FileAttachment?rev=&filename=Smile.gif">Smile.gif</a></td>
150             <td><a href="http://www.dementia.org/twiki//attach/TWiki/FileAttachment?filename=Smile.gif&revInfo=1">action</a></td>
151             <td> 94 </td>
152             <td> 22 Jul 2000 - 19:38 </td>
153             <td><a href="PeterThoeny">PeterThoeny</a></td>
154             <td> Smiley face </td>
155             <td align="center">   </td>
156           </tr>
157         </table>
158         <p>
159         </p>
160         <h2>Update attachment <code>Sample.txt</code></h2>
161         <p>
162         </p>
163         <table border="1" cellpadding="1" cellspacing="0">
164           <tr>
165             <th align="center" bgcolor="#99CCCC"><strong>Version:</strong></th>
166             <th align="center" bgcolor="#99CCCC"><strong>Action:</strong></th>
167             <th align="center" bgcolor="#99CCCC"><strong>Date:</strong></th>
168             <th align="center" bgcolor="#99CCCC"><strong>Who:</strong></th>
169             <th align="center" bgcolor="#99CCCC"><strong>Comment:</strong></th>
170           </tr>
171           <tr>
172             <td> 1.1 </td>
173             <td><a href="http://www.dementia.org/twiki//viewfile/TWiki/FileAttachment?rev=1.1&filename=Sample.txt">view</a></td>
174             <td> 2001.08.30.09.28.56 </td>
175             <td><a href="PeterThoeny">PeterThoeny</a></td>
176             <td>   </td>
177           </tr>
178         </table>
179         <p>
180         </p>
181         <table width="100%">
182           <tr>
183             <td align="right"> Previous <br /> upload: </td>
184             <td><code>C:\DATA\Sample.txt</code> (<a href="PeterThoeny">PeterThoeny</a>) </td>
185           </tr>
186           <tr>
187             <td align="right"> Local file: </td>
188             <td><input name="filename" type="hidden" value="Sample.txt" /> <input name="filepath" size="50" type="file" value="C:\DATA\Sample.txt" /></td>
189           </tr>
190           <tr>
191             <td align="right"> Comment: </td>
192             <td><input maxlength="50" name="filecomment" size="50" type="text" value="Just a sample" /></td>
193           </tr>
194           <tr>
195             <td align="right"> Link: </td>
196             <td><input name="createlink" type="checkbox" /> Create a link to the attached file at the end of the topic. </td>
197           </tr>
198           <tr>
199             <td align="right"> Hide file: </td>
200             <td><input name="hidefile" type="checkbox" /> Hide attachment in normal topic view. </td>
201           </tr>
202         </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/TWiki/FileAttachment?attachment=Sample.txt">Move attachment</a> | <a href="FileAttachment">Cancel</a> } </td>
203     </tr>
204   </table>
205 </form>
206
207 The first table is a list of all attachments, including their _attributes_. A `h` means the attachment is hidden i.e. isn't listed when viewing a topic.
208
209 The second table is all the versions of the attachment. Click on `view` to see that version, if it is the most recent version you'll be taken to a URL that always displays the latest version, which is usually what you want to email out.
210
211 If you just want to change the comment on an attachment - enter a new comment and then press _Change properties_. Note that the comment listed against the specific version will not change, however the comment displayed when viewing the topic does change.
212
213 Similarly to hide/unhide an attachment click in the _Hide file_ checkbox are press _Change properties_.
214
215 ### <a name="Known Issues"></a> Known Issues
216
217 - You can't lock an attachment for editing. However, you may want to change the comment to indicate you are doing that - the comment on the specific version isn't lost, you can see it when listing all the versions of an attachments.