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 files attached to it, similar to an email attachment. Use your browser to upload or download a file. Attachments are stored under revision control, so uploads can never be lost, and files changes can be made with a rollback option that lets you retrieve all previous versions.
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 groupware solutions - file sharing, document management - and for speedy Web 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; create a central reference library that's easy to access and manage by an entire user group.
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 embed on a page) and place them anywhere in on a single page, or for use across a web, or site-wide.
42   - **_NOTE:_** You can also add graphics - any files - directly, typically by FTP upload. This requires server access, and may be more convenient if a large number of files, or a particular directory location, is required. These files can't be managed using browser-based Attachment controls.
43
44 ### <a name="Uploading Files"></a> Uploading Files
45
46 - 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]].
47   - Files of any type can be uploaded. Some files that might impose a security risk are renamed, ex: `*.php` files are renamed to `*.php.txt`.
48   - Currently there is no file size limit besides the disk space on the server.
49   - 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.
50
51 ### <a name="Downloading Files"></a> Downloading Files
52
53 - To download: Click on the file in the [[File Attachment table|Main/WebHome#FileAttachmentTable]].
54
55 <a name="AttachmentAccess"></a>
56
57 - **_NOTE:_** There is no access control on individual attachments. If you need this type of control, create separate topics and define [[access restrictions|Main/TWikiDocumentation#TWikiAccessControl]] per topic.
58
59 ### <a name="Moving Attachment Files"></a> Moving Attachment Files
60
61 An attachement can be moved between topics. To do this click **Action** on the attachment to be moved. On the control page, select the new web and topic, the click **Move**. The attachment and its version history are moved. The original location is stored as [[topic Meta Data|Main/TWikiDocumentation#Meta_Data_Definition]].
62
63 ### <a name="Deleting Attachments"></a> Deleting Attachments
64
65 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.
66
67 ### <a name="Linking to Attached Files"></a> Linking to Attached Files
68
69 - Once a file is attached it can be referenced in the topic. Example:
70   1. **Attach** file: `Sample.txt`
71   2. **Edit** topic and write text: `%ATTACHURL%/Sample.txt`
72   3. **Preview** - `%ATTACHURL` text appears as: <http://www.dementia.org/twiki//view/%WEB%/%TOPIC%/Sample.txt>, a link.
73
74 - To reference an attachment located in another topic, write text:
75   - `%PUBURL%/%WEB%/OtherTopic/Sample.txt` (for the same web)
76   - `%PUBURL%/Otherweb/OtherTopic/Sample.txt` (for adifferent web)
77
78 - Attached HTML files and text files can be inlined in a topic. Example:
79   1. **Attach** file: `Sample.txt`
80   2. **Edit** topic and write text: `%INCLUDE{"%ATTACHURL%/Sample.txt"}%`
81     - Content of attached file is shown inlined.
82     - Read more in [[IncludeTopicsAndWebPages]].
83
84 - GIF, JPG and PNG images can be attached and shown embedded in a topic. Example:
85   1. **Attach** file: `Smile.gif`
86   2. **Edit** topic and write text: `%ATTACHURL%/Smile.gif`
87   3. **Preview** - text appears as ![Smile.gif](http://www.dementia.org/twiki//view/%WEB%/%TOPIC%/Smile.gif), an image.
88
89 <a name="FileAttachmentTable"></a>
90
91 ### <a name="File Attachment Contents Table"></a> File Attachment Contents Table
92
93 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**.
94
95 > <table border="1" cellpadding="20" cellspacing="0" width="90%">
96 >   <tr>
97 >     <td>
98 >       <table border="1" cellpadding="1" cellspacing="0">
99 >         <tr>
100 >           <th align="center" bgcolor="#99CCCC"><strong><a href="FileAttachment">Attachment</a>:</strong></th>
101 >           <th align="center" bgcolor="#99CCCC"><strong>Action:</strong></th>
102 >           <th align="center" bgcolor="#99CCCC"><strong>Size:</strong></th>
103 >           <th align="center" bgcolor="#99CCCC"><strong>Date:</strong></th>
104 >           <th align="center" bgcolor="#99CCCC"><strong>Who:</strong></th>
105 >           <th align="center" bgcolor="#99CCCC"><strong>Comment:</strong></th>
106 >         </tr>
107 >         <tr>
108 >           <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>
109 >           <td><a href="http://www.dementia.org/twiki//attach/%WEB%/%TOPIC%?filename=Sample.txt&revInfo=1">action</a></td>
110 >           <td> 30 </td>
111 >           <td> 22 Jul 2000 - 19:37 </td>
112 >           <td><a href="PeterThoeny">PeterThoeny</a></td>
113 >           <td> Just a sample </td>
114 >         </tr>
115 >         <tr>
116 >           <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>
117 >           <td><a href="http://www.dementia.org/twiki//attach/%WEB%/%TOPIC%?filename=Smile.gif&revInfo=1">action</a></td>
118 >           <td> 94 </td>
119 >           <td> 22 Jul 2000 - 19:38 </td>
120 >           <td><a href="PeterThoeny">PeterThoeny</a></td>
121 >           <td> Smiley face </td>
122 >         </tr>
123 >       </table>
124 >     </td>
125 >   </tr>
126 > </table>
127
128 ### <a name="File Attachment Controls"></a> File Attachment Controls
129
130 Clicking on an **Action** link takes you to a new page that looks like this:
131
132 > <form>
133 >   <table border="1" cellpadding="20" cellspacing="0">
134 >     <tr>
135 >       <td>
136 >         <table border="1" cellpadding="1" cellspacing="0">
137 >           <tr>
138 >             <th align="center" bgcolor="#99CCCC"><strong><a href="FileAttachment">Attachment</a>:</strong></th>
139 >             <th align="center" bgcolor="#99CCCC"><strong>Action:</strong></th>
140 >             <th align="center" bgcolor="#99CCCC"><strong>Size:</strong></th>
141 >             <th align="center" bgcolor="#99CCCC"><strong>Date:</strong></th>
142 >             <th align="center" bgcolor="#99CCCC"><strong>Who:</strong></th>
143 >             <th align="center" bgcolor="#99CCCC"><strong>Comment:</strong></th>
144 >             <th align="center" bgcolor="#99CCCC"><strong><a href="FileAttribute">Attribute</a>:</strong></th>
145 >           </tr>
146 >           <tr>
147 >             <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>
148 >             <td><a href="http://www.dementia.org/twiki//attach/%WEB%/%TOPIC%?filename=Sample.txt&revInfo=1">action</a></td>
149 >             <td> 30 </td>
150 >             <td> 22 Jul 2000 - 19:37 </td>
151 >             <td><a href="PeterThoeny">PeterThoeny</a></td>
152 >             <td> Just a sample </td>
153 >             <td align="center">   </td>
154 >           </tr>
155 >           <tr>
156 >             <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>
157 >             <td><a href="http://www.dementia.org/twiki//attach/%WEB%/%TOPIC%?filename=Smile.gif&revInfo=1">action</a></td>
158 >             <td> 94 </td>
159 >             <td> 22 Jul 2000 - 19:38 </td>
160 >             <td><a href="PeterThoeny">PeterThoeny</a></td>
161 >             <td> Smiley face </td>
162 >             <td align="center">   </td>
163 >           </tr>
164 >         </table>
165 >         <p>
166 >         </p>
167 >         <h2>Update attachment <code>Sample.txt</code></h2>
168 >         <p>
169 >         </p>
170 >         <table border="1" cellpadding="1" cellspacing="0">
171 >           <tr>
172 >             <th align="center" bgcolor="#99CCCC"><strong>Version:</strong></th>
173 >             <th align="center" bgcolor="#99CCCC"><strong>Action:</strong></th>
174 >             <th align="center" bgcolor="#99CCCC"><strong>Date:</strong></th>
175 >             <th align="center" bgcolor="#99CCCC"><strong>Who:</strong></th>
176 >             <th align="center" bgcolor="#99CCCC"><strong>Comment:</strong></th>
177 >           </tr>
178 >           <tr>
179 >             <td> 1.1 </td>
180 >             <td><a href="http://www.dementia.org/twiki//viewfile/%WEB%/%TOPIC%?rev=1.1&filename=Sample.txt">view</a></td>
181 >             <td> 2001.08.30.09.28.56 </td>
182 >             <td><a href="PeterThoeny">PeterThoeny</a></td>
183 >             <td>   </td>
184 >           </tr>
185 >         </table>
186 >         <p>
187 >         </p>
188 >         <table width="100%">
189 >           <tr>
190 >             <td align="right"> Previous <br /> upload: </td>
191 >             <td><code>C:\DATA\Sample.txt</code> (<a href="PeterThoeny">PeterThoeny</a>) </td>
192 >           </tr>
193 >           <tr>
194 >             <td align="right"> Local file: </td>
195 >             <td><input name="filename" type="hidden" value="Sample.txt" /> <input name="filepath" size="50" type="file" value="C:\DATA\Sample.txt" /></td>
196 >           </tr>
197 >           <tr>
198 >             <td align="right"> Comment: </td>
199 >             <td><input maxlength="50" name="filecomment" size="50" type="text" value="Just a sample" /></td>
200 >           </tr>
201 >           <tr>
202 >             <td align="right"> Link: </td>
203 >             <td><input name="createlink" type="checkbox" /> Create a link to the attached file at the end of the topic. </td>
204 >           </tr>
205 >           <tr>
206 >             <td align="right"> Hide file: </td>
207 >             <td><input name="hidefile" type="checkbox" /> Hide attachment in normal topic view. </td>
208 >           </tr>
209 >         </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>
210 >     </tr>
211 >   </table>
212 > </form>
213
214 - 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.
215
216 - 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.
217   - **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.
218   - **To hide/unhide** an attachment, enable the **Hide file** checkbox, then click **Change properties**.
219
220 ### <a name="Known Issues"></a> Known Issues
221
222 - 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.