buildrelease
[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 archive data, or 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   - **_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.
48   - 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.
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   - TWiki can limit the file size. This is defined by the `%ATTACHFILESIZELIMIT%` variable of the [[TWikiPreferences]], currently set at %ATTACHFILESIZELIMIT% KB.
51     - %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.
52 - Automatic attachments:
53   - 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.
54   - To enable this feature, set the \{AutoAttachPubDir\} configuration option.
55   - **_NOTE:_** The automatic attachment feature can only be used by an administrator who has access to the server's file system.
56
57 ## <a name="Downloading Files"></a> Downloading Files
58
59 - Click on the file in the [[File Attachment table|Main/WebHome#FileAttachmentTable]].
60
61 <a name="AttachmentAccess"></a>
62
63 - %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.
64
65 ## <a name="Moving Attachment Files"></a> Moving Attachment Files
66
67 An attachment can be moved between topics.
68
69 - Click <code>**Manage**</code> on the Attachment to be moved.
70 - On the control screen, select the new web and/or topic.
71 - 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]].
72
73 ## <a name="Deleting Attachments"></a> Deleting Attachments
74
75 Move unwanted Attachments to web `Trash`, topic `TrashAttachment`.
76
77 ## <a name="Linking to Attached Files"></a> Linking to Attached Files
78
79 - Once a file is attached it can be referenced in the topic. Example:
80   1. <code>**Attach**</code> file: `Sample.txt`
81   2. <code>**Edit**</code> topic and enter: `%ATTACHURL%/Sample.txt`
82   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.
83
84 - To reference an attachment located in another topic, enter:
85   - `%PUBURLPATH%/%WEB%/OtherTopic/Sample.txt` (if it's within the same web)
86   - `%PUBURLPATH%/Otherweb/OtherTopic/Sample.txt` (if it's in a different web)
87
88 - Attached HTML files and text files can be inlined in a topic. Example:
89   1. <code>**Attach**</code> file: `Sample.txt`
90   2. <code>**Edit**</code> topic and write text: `%INCLUDE{"%ATTACHURL%/Sample.txt"}%`
91     - Content of attached file is shown inlined.
92     - Read more about INCLUDE in [[TWikiVariables|Main/TWikiVariables#VarINCLUDE]]
93
94 - GIF, JPG and PNG images can be attached and shown embedded in a topic. Example:
95   1. <code>**Attach**</code> file: `Smile.gif`
96   2. <code>**Edit**</code> topic and write text: `%ATTACHURL%/Smile.gif`
97   3. <code>**Preview**</code>: text appears as ![Smile.gif](http://www.dementia.org/twiki//view/%WEB%/%TOPIC%/Smile.gif), an image.
98
99 <a name="FileAttachmentTable"></a>
100
101 ## <a name="File Attachment Contents Table"></a> File Attachment Contents Table
102
103 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**.
104
105 > <table border="1" cellpadding="1" cellspacing="0">
106 >   <tr>
107 >     <th align="center" bgcolor="#99CCCC"><strong>I</strong></th>
108 >     <th align="center" bgcolor="#99CCCC"><strong>Attachment</strong></th>
109 >     <th align="center" bgcolor="#99CCCC"><strong>Action</strong></th>
110 >     <th align="center" bgcolor="#99CCCC"><strong>Size</strong></th>
111 >     <th align="center" bgcolor="#99CCCC"><strong>Date</strong></th>
112 >     <th align="center" bgcolor="#99CCCC"><strong>Who</strong></th>
113 >     <th align="center" bgcolor="#99CCCC"><strong>Comment</strong></th>
114 >   </tr>
115 >   <tr>
116 >     <td><img align="top" alt="txt" border="0" height="16" src="http://www.dementia.org/twiki//view/Main/WebHome/txt.gif" width="16" /></td>
117 >     <td><a href="http://www.dementia.org/twiki/viewfile/%WEB%/%TOPIC%?rev=&filename=Sample.txt">Sample.txt</a></td>
118 >     <td><a href="http://www.dementia.org/twiki/attach/%WEB%/%TOPIC%?filename=Sample.txt&revInfo=1">manage</a></td>
119 >     <td align="right"> 0.1 K </td>
120 >     <td> 22 Jul 2000 - 19:37 </td>
121 >     <td><a href="UploadingUser">UploadingUser</a></td>
122 >     <td> Just a sample </td>
123 >   </tr>
124 >   <tr>
125 >     <td><img align="top" alt="bmp" border="0" height="16" src="http://www.dementia.org/twiki//view/Main/WebHome/bmp.gif" width="16" /></td>
126 >     <td><a href="http://www.dementia.org/twiki/viewfile/%WEB%/%TOPIC%?rev=&filename=Smile.gif">Smile.gif</a></td>
127 >     <td><a href="http://www.dementia.org/twiki/attach/%WEB%/%TOPIC%?filename=Smile.gif&revInfo=1">manage</a></td>
128 >     <td align="right"> 0.1 K </td>
129 >     <td> 22 Jul 2000 - 19:38 </td>
130 >     <td><a href="UploadingUser">UploadingUser</a></td>
131 >     <td> Smiley face </td>
132 >   </tr>
133 > </table>
134
135 ## <a name="File Attachment Controls"></a> File Attachment Controls
136
137 Clicking on a <code>**Manage**</code> link takes you to a new page that looks a bit like this (depending on what [[skin|Main/TWikiSkins]] is selected):
138
139 > <form>
140 >   <table border="1" cellpadding="20" cellspacing="0">
141 >     <tr>
142 >       <td>
143 >         <h2>Update attachment <code>Sample.txt</code></h2>
144 >         <div>
145 >           <table border="1" cellpadding="1" cellspacing="0">
146 >             <tr>
147 >               <th align="center" bgcolor="#99CCCC"><strong>Version</strong></th>
148 >               <th align="center" bgcolor="#99CCCC"><strong>Action</strong></th>
149 >               <th align="center" bgcolor="#99CCCC"><strong>Date</strong></th>
150 >               <th align="center" bgcolor="#99CCCC"><strong>Who</strong></th>
151 >               <th align="center" bgcolor="#99CCCC"><strong>Comment</strong></th>
152 >             </tr>
153 >             <tr>
154 >               <td> 1 </td>
155 >               <td><a href="http://www.dementia.org/twiki/viewfile/%WEB%/%TOPIC%?rev=1&filename=Sample.txt">view</a></td>
156 >               <td> 22 Jul 2000 - 19:37 </td>
157 >               <td><a href="UploadingUser">UploadingUser</a></td>
158 >               <td> Just a sample </td>
159 >             </tr>
160 >           </table>
161 >         </div>
162 >         <p>
163 >         </p>
164 >         <div>
165 >           <table>
166 >             <tr>
167 >               <th>Previous upload</th>
168 >               <td><code>Sample.txt</code> <span>(<a href="http://visiblearea.com/devtwiki/bin/view/Main/TWikiContributor">TWikiContributor</a>)</span></td>
169 >               <td>Select a new local file to update this attachment.</td>
170 >             </tr>
171 >             <tr>
172 >               <th> Local file </th>
173 >               <td><input name="filename" type="hidden" value="Sample.txt" /><input name="filepath" size="30" type="file" value="Sample.txt" /></td>
174 >               <td> Upload up to 10000 KB. </td>
175 >             </tr>
176 >             <tr>
177 >               <th> Comment </th>
178 >               <td><input maxlength="256" name="filecomment" size="50" type="text" value="Just a sample" /></td>
179 >               <td>
180 >               </td>
181 >             </tr>
182 >             <tr>
183 >               <th> Link </th>
184 >               <td><input id="createlink" name="createlink" type="checkbox" /><label for="createlink">Create a link to the attached file</label>
185 >               </td>
186 >               <td> Images will be displayed, for other attachments a link will be created. </td>
187 >             </tr>
188 >             <tr>
189 >               <th> Hide file </th>
190 >               <td><input id="hidefile" name="hidefile" type="checkbox" /><label for="hidefile">Do not show attachment in table</label>
191 >               </td>
192 >               <td>Attachments will not be shown in topic view page.</td>
193 >             </tr>
194 >             <tr>
195 >               <th>
196 >               </th>
197 >               <td colspan="2"><input name="changeproperties" type="submit" value="Change properties only" /></td>
198 >             </tr>
199 >           </table>
200 >         </div>
201 >       </td>
202 >     </tr>
203 >   </table>
204 > </form>
205
206 - 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.
207
208 - 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.
209   - **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.
210   - **To hide/unhide** an attachment, enable the <code>**Hide file**</code> checkbox, then click <code>**Change properties**</code>.
211
212 ## <a name="Known Issues"></a> Known Issues
213
214 - 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.
215 - Attachments are not secured. Anyone can read them if they know the name of the web, topic and attachment.
216
217 **_Related Topics:_** [[UserDocumentationCategory]]