%TOC% %STARTINCLUDE% ---## File Attachments 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. ---+++ What Are Attachments Good For? ---++++ Document Management System * __document management system: distribution, revision__ ---++++ File Sharing * __share files: applications, data files; recommended for light use__ ---++++ Page Content * __on-site use: linking to graphics, docs__ ---+++ Uploading Files * 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 [[#FileAttachmentTable][File Attachment table]]. * 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=. * 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. ---+++ Downloading Files * To download: Click on the file in the [[#FileAttachmentTable][File Attachment table]]. * 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. ---+++ Moving Attachment Files 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 [[TWikiDocumentation#Meta_Data_Definition][topic meta data]]. ---+++ Deleting Attachments 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. ---+++ Linking to Attached Files * Once a file is attached it can be referenced in the topic. Example: * Attach file: =Sample.txt= * Edit topic and write text: =%<nop>ATTACHURL%/Sample.txt= * Text is shown as: %PUBURL%/%WEB%/%TOPIC%/Sample.txt, ex: it is a link. * To reference an attachment located in another topic write text: * =%<nop>PUBURL%/%<nop>WEB%/OtherTopic/Sample.txt= (for same web) * =%<nop>PUBURL%/Otherweb/OtherTopic/Sample.txt= (for different web) * Attached HTML files and text files can be inlined in a topic. Example: * Attach file: =Sample.txt= * Edit topic and write text: =%<nop>INCLUDE{"%<nop>ATTACHURL%/Sample.txt"}%= * 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: * Attach file: =Smile.gif= * Edit topic and write text: =%<nop>ATTACHURL%/Smile.gif= * Text is shown as: %PUBURL%/%WEB%/%TOPIC%/Smile.gif , it shows up as an image. #FileAttachmentTable ---+++ File Attachment Contents Table Is a table that looks like this: <table border="1" cellspacing="0" cellpadding="20"><tr><td> <table border="1" cellspacing="0" cellpadding="1"> <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 src="%PUBURLPATH%/icn/txt.gif" width="16" height="16" align="top" /> <a href="%SCRIPTURLPATH%/viewfile%SCRIPTSUFFIX%/TWiki/FileAttachment?rev=&filename=Sample.txt">Sample.txt</a> </td><td> <a href="%SCRIPTURLPATH%/attach%SCRIPTSUFFIX%/TWiki/FileAttachment?filename=Sample.txt&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 src="%PUBURLPATH%/icn/bmp.gif" width="16" hight="16" align="top" /> <a href="%SCRIPTURLPATH%/viewfile%SCRIPTSUFFIX%/TWiki/FileAttachment?rev=&filename=Smile.gif">Smile.gif</a> </td><td> <a href="%SCRIPTURLPATH%/attach%SCRIPTSUFFIX%/TWiki/FileAttachment?filename=Smile.gif&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> ---+++ File Attachment Control Page Clicking on an action link takes you to a new page that looks like this: <form> <table border="1" cellspacing="0" cellpadding="20"><tr><td> <table border="1" cellspacing="0" cellpadding="1"> <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 src="%PUBURLPATH%/icn/txt.gif" width="16" height="16" align="top" /> <a href="%SCRIPTURLPATH%/viewfile%SCRIPTSUFFIX%/TWiki/FileAttachment?rev=&filename=Sample.txt">Sample.txt</a> </td><td> <a href="%SCRIPTURLPATH%/attach%SCRIPTSUFFIX%/TWiki/FileAttachment?filename=Sample.txt&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 src="%PUBURLPATH%/icn/bmp.gif" width="16" height="16" align="top" /> <a href="%SCRIPTURLPATH%/viewfile%SCRIPTSUFFIX%/TWiki/FileAttachment?rev=&filename=Smile.gif">Smile.gif</a> </td><td> <a href="%SCRIPTURLPATH%/attach%SCRIPTSUFFIX%/TWiki/FileAttachment?filename=Smile.gif&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> <nop><h2>Update attachment <code>Sample.txt</code></h2> <table border="1" cellspacing="0" cellpadding="1"> <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="%SCRIPTURLPATH%/viewfile%SCRIPTSUFFIX%/TWiki/FileAttachment?rev=1.1&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 /> <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 type="hidden" name="filename" value="Sample.txt" /> <input type="file" name="filepath" value="C:\DATA\Sample.txt" size="50" /> </td> </tr> <tr> <td align="right"> Comment: </td><td> <input type="text" name="filecomment" value="Just a sample" maxlength="50" size="50" /> </td> </tr> <tr> <td align="right"> Link: </td><td> <input type="checkbox" name="createlink" /> Create a link to the attached file at the end of the topic. </td> </tr> <tr> <td align="right"> Hide file: </td><td> <input type="checkbox" name="hidefile" /> Hide attachment in normal topic view. </td> </tr> </table> _Help text ..._ Topic <b>FileAttachment</b> . { <input type="submit" value=" Upload file " /> | <input type="submit" name="changeproperties" value="Change properties" /> | <a href="%SCRIPTURLPATH%/rename%SCRIPTSUFFIX%/TWiki/FileAttachment?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_. A =h= means the attachment is hidden i.e. 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 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. 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. Similarly to hide/unhide an attachment click in the _Hide file_ checkbox are press _Change properties_. ---+++ Known Issues * 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.
Attachments
Attachments
Topic attachments
I
Attachment
History
Action
Size
Date
Who
Comment
txt
Sample.txt
manage
0.1 K
2000-07-22 - 19:37
UnknownUser
Just a sample
gif
Smile.gif
manage
0.1 K
2000-07-22 - 19:38
UnknownUser
Smiley face
This topic: TWiki
>
FileAttachment
Topic revision: r5 - 2001-09-07 - PeterThoeny
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback
Note:
Please contribute updates to this topic on TWiki.org at
TWiki:TWiki.FileAttachment
.