summaryrefslogtreecommitdiff
path: root/TWiki/FileAttachment.mdwn
blob: 2f4141918241459d07a325bbc4fa9c8ca9c84580 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
%TOC% %STARTINCLUDE%

## <a name="File_Attachments"> File Attachments </a>

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.

### <a name="What_Are_Attachments_Good_For_"> What Are Attachments Good For? </a>

File Attachments can be used to create powerful groupware solutions - file sharing, document management - and for speedy Web authoring.

#### <a name="Document_Management_System"> Document Management System </a>

* 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 using; create a central reference library that's easy to access and manage by an entire user group.

#### <a name="File_Sharing"> File Sharing </a>

* 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!

#### <a name="Web_Authoring"> Web Authoring </a>

* 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.
  * **_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.

### <a name="Uploading_Files"> Uploading Files </a>

* 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.
  * 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`.
  * Currently there is no file size limit besides the disk space on the server.
  * 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.

### <a name="Downloading_Files"> Downloading Files </a>

* To download: Click on the file in the File Attachment table.

<a name="AttachmentAccess"></a>

* **_NOTE:_** There is no access control on individual attachments. If you need this type of control, create separate topics and define [[TWikiDocumentation]] per topic.

### <a name="Moving_Attachment_Files"> Moving Attachment Files </a>

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 [[TWikiDocumentation]].

### <a name="Deleting_Attachments"> Deleting Attachments </a>

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.

### <a name="Linking_to_Attached_Files"> Linking to Attached Files </a>

* Once a file is attached it can be referenced in the topic. Example:
  1. **Attach** file: `Sample.txt`
  2. **Edit** topic and write text: <code>%ATTACHURL%/Sample.txt</code>
  3. **Preview** - <code>%ATTACHURL</code> text appears as: %PUBURL%/%WEB%/%TOPIC%/Sample.txt, a link.

* To reference an attachment located in another topic, write text:
  * <code>%PUBURL%/%WEB%/OtherTopic/Sample.txt</code> (for the same web)
  * <code>%PUBURL%/Otherweb/OtherTopic/Sample.txt</code> (for adifferent web)

* Attached HTML files and text files can be inlined in a topic. Example:
  1. **Attach** file: `Sample.txt`
  2. **Edit** topic and write text: <code>%INCLUDE\{"%ATTACHURL%/Sample.txt"\}%</code>
    * Content of attached file is shown inlined.
    * Read more in [[IncludeTopicsAndWebPages]].

* GIF, JPG and PNG images can be attached and shown embedded in a topic. Example:
  1. **Attach** file: `Smile.gif`
  2. **Edit** topic and write text: <code>%ATTACHURL%/Smile.gif</code>
  3. **Preview** - text appears as %PUBURL%/%WEB%/%TOPIC%/Smile.gif, an image.

<a name="FileAttachmentTable"></a>

### <a name="File_Attachment_Contents_Table"> File Attachment Contents Table </a>

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**.

> <table border="1" cellpadding="20" cellspacing="0" width="90%">
>   <tr>
>     <td>
>       <table border="1" cellpadding="1" cellspacing="0">
>         <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>
>         <tr>
>           <td><img align="top" height="16" src="%PUBURL%/icn/txt.gif" width="16" /> <a href="%SCRIPTURL%/viewfile%SCRIPTSUFFIX%/%WEB%/%TOPIC%?rev=&amp;filename=Sample.txt">Sample.txt</a></td>
>           <td><a href="%SCRIPTURL%/attach%SCRIPTSUFFIX%/%WEB%/%TOPIC%?filename=Sample.txt&amp;revInfo=1">action</a></td>
>           <td> 30 </td>
>           <td> 22 Jul 2000 - 19:37 </td>
>           <td><a href="PeterThoeny">PeterThoeny</a></td>
>           <td> Just a sample </td>
>         </tr>
>         <tr>
>           <td><img align="top" hight="16" src="%PUBURL%/icn/bmp.gif" width="16" /> <a href="%SCRIPTURL%/viewfile%SCRIPTSUFFIX%/%WEB%/%TOPIC%?rev=&amp;filename=Smile.gif">Smile.gif</a></td>
>           <td><a href="%SCRIPTURL%/attach%SCRIPTSUFFIX%/%WEB%/%TOPIC%?filename=Smile.gif&amp;revInfo=1">action</a></td>
>           <td> 94 </td>
>           <td> 22 Jul 2000 - 19:38 </td>
>           <td><a href="PeterThoeny">PeterThoeny</a></td>
>           <td> Smiley face </td>
>         </tr>
>       </table>
>     </td>
>   </tr>
> </table>

### <a name="File_Attachment_Controls"> File Attachment Controls </a>

Clicking on an **Action** link takes you to a new page that looks like this:

> <form>
>   <table border="1" cellpadding="20" cellspacing="0">
>     <tr>
>       <td>
>         <table border="1" cellpadding="1" cellspacing="0">
>           <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>
>           <tr>
>             <td><img align="top" height="16" src="%PUBURL%/icn/txt.gif" width="16" /> <a href="%SCRIPTURL%/viewfile%SCRIPTSUFFIX%/TWiki/%WEB%/%TOPIC%?rev=&amp;filename=Sample.txt">Sample.txt</a></td>
>             <td><a href="%SCRIPTURL%/attach%SCRIPTSUFFIX%/%WEB%/%TOPIC%?filename=Sample.txt&amp;revInfo=1">action</a></td>
>             <td> 30 </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>
>           <tr>
>             <td><img align="top" height="16" src="%PUBURL%/icn/bmp.gif" width="16" /> <a href="%SCRIPTURL%/viewfile%SCRIPTSUFFIX%/%WEB%/%TOPIC%?rev=&amp;filename=Smile.gif">Smile.gif</a></td>
>             <td><a href="%SCRIPTURL%/attach%SCRIPTSUFFIX%/%WEB%/%TOPIC%?filename=Smile.gif&amp;revInfo=1">action</a></td>
>             <td> 94 </td>
>             <td> 22 Jul 2000 - 19:38 </td>
>             <td><a href="PeterThoeny">PeterThoeny</a></td>
>             <td> Smiley face </td>
>             <td align="center">   </td>
>           </tr>
>         </table>
>         <p><nop></nop></p>
>         <h2>Update attachment <code>Sample.txt</code></h2>
>         <p>
>         </p>
>         <table border="1" cellpadding="1" cellspacing="0">
>           <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>
>           <tr>
>             <td> 1.1 </td>
>             <td><a href="%SCRIPTURL%/viewfile%SCRIPTSUFFIX%/%WEB%/%TOPIC%?rev=1.1&amp;filename=Sample.txt">view</a></td>
>             <td> 2001.08.30.09.28.56 </td>
>             <td><a href="PeterThoeny">PeterThoeny</a></td>
>             <td>   </td>
>           </tr>
>         </table>
>         <p>
>         </p>
>         <table width="100%">
>           <tr>
>             <td align="right"> Previous <br /> upload: </td>
>             <td><code>C:\DATA\Sample.txt</code> (<a href="PeterThoeny">PeterThoeny</a>) </td>
>           </tr>
>           <tr>
>             <td align="right"> Local file: </td>
>             <td><input name="filename" type="hidden" value="Sample.txt" /> <input name="filepath" size="50" type="file" value="C:\DATA\Sample.txt" /></td>
>           </tr>
>           <tr>
>             <td align="right"> Comment: </td>
>             <td><input maxlength="50" name="filecomment" size="50" type="text" value="Just a sample" /></td>
>           </tr>
>           <tr>
>             <td align="right"> Link: </td>
>             <td><input name="createlink" type="checkbox" /> Create a link to the attached file at the end of the topic. </td>
>           </tr>
>           <tr>
>             <td align="right"> Hide file: </td>
>             <td><input name="hidefile" type="checkbox" /> Hide attachment in normal topic view. </td>
>           </tr>
>         </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="%SCRIPTURLPATH%/rename%SCRIPTSUFFIX%/%WEB%/%TOPIC%?attachment=Sample.txt">Move attachment</a> | <a href="FileAttachment">Cancel</a> } </td>
>     </tr>
>   </table>
> </form>

* 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.

* 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.
  * **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.
  * **To hide/unhide** an attachment, enable the **Hide file** checkbox, then click **Change properties**.

### <a name="Known_Issues"> Known Issues </a>

* 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.