上传
PmWiki 允许作者上传存储类似于图片的附件。 以便作者在任何页面中使用。
附件:
语法
添加一个附件链接可以用 "Attach:
"加附件名的方式 (例如, "Attach:resume.pdf
").。 When the page is displayed, the Attach:
markup becomes one of the following:
- A link to the named attachment (if uploaded, ie already in the upload directory)
- A link to a form whereby the author can specify a file to be uploaded and used as the new attachment (if not yet uploaded, ie not in the upload directory)
- If the attachment is an image file with an extension such as .gif, .jpeg, or .png, it is displayed as an image.
The behaviour of links can be modified to
- prevent an image attachment from displaying as an image, place it in double brackets (e.g.,
[[Attach:image.jpg]]
). - have a link to an attachment appear without the "
Attach:
" at the beginning of the link, use[[(Attach:)file.ext]]
.
其它页面或组的附件
To link to an uploaded attachment (image or file) from another group, you simply refer the group itself (make sure "Groupname" has the dot in it).
Attach:Groupname./file_name.ext
(note the dot after the groupname)
If PmWiki is configured with an individual directory per page use
Attach:Pagename/file_name.ext
(Pagename is in the same WikiGroup)
Attach:Groupname.Pagename/file_name.ext
包含空格的附件名
To link to a filename with spaces in it use the bracket link notation, eg
[[Attach:a filename with spaces.txt]]
To attach an image file with spaces in the name so that is shows as an image use one of these workarounds
[[#blank | Attach:image space.jpeg]]
[[#1 | Attach:image space.jpeg]]
在一个页面列出所有附件
To list files that have been uploaded, use the markup:
(:attachlist:)
This will list attachments to the current group or page, depending whether attachments are organised per group or per page; each instance includes a link to the attachment for viewing or downloading. A list of attachments is also shown as part of the uploads page form.
上传页面
可以在页面地址后,直接增加"?action=upload"来打开一个上传页面。你可以通过这个页面上传并重命名这个附件。注意:这需要管理员开启附件上传功能。
- 要开启上传功能,请在
local/config.php
增加
这行。$EnableUploadVersions
=1;
设置附件类型和上传尺寸
为了安全起见,上传功能默认是关闭的。 When enabled uploads are restricted as to the types and sizes of files that may be uploaded to the server (see UploadsAdmin). PmWiki's default configuration limits file sizes to 50 kilobytes and file extensions to common types such as ".gif", ".jpeg", ".doc", ".txt", and ".pdf".
In addition, the administrator can configure the system to require an upload
password--see Passwords and PasswordsAdmin.
默认允许上传一下扩展名的文件:
'gif','jpg','jpeg','png','bmp','ico','wbmp', # 图片
'mp3', 'au','wav', # 音频 'mpg','mpeg','wmf','mov','qt','avi', # 视频 'zip', 'gz','tgz','tar','rpm','hqx','7z' # 压缩包 'odt','ods','odp', # OpenOffice.org 'doc','ppt','xls','exe','mdb', # MSOffice 'pdf','psd', 'ps','ai','eps', # Adobe 'htm','html','fla','swf', # web stuff 'txt','rtf','exe','tex','dvi','' # misc
移除
任何上传的文件都可以通过管理员来移动、删除处理。
管理员可以通过ftp方式或通过这个 Cookbook:Attachtable 功能来管理附件。
我如何让上传的文件只显示文件名,例如:"file.doc"?
像这样[[(Attach:)file.doc]]
使用一个括号就可以了。附件链接中有更多方法。
如何更改上传附件大小限制?
PmWiki默认的图片大小限制在50kB以下。 请添加如下代码:
$UploadMaxSize
= 1000000; # limit upload file size to 1 megabyte
为什么上传出现"Incomplete file received"这样的错误提示?
You may be running out of space in a 'scratch' area, used either by PmWiki or by PHP. On *nix, check that you have sufficient free space in /tmp and /var/tmp.
How do I make it so that the upload link still allows one to make another upload (if someone wants to replace the old version of a file with a newer version, for example). Currently you only get the upload link when there is no file in the upload directory.
Use the Attach page action, and click on the delta symbol (Δ) shown against each of files listed. If you can't see the attach action either uploads are not enabled, you are not authorized to upload, or the attach action has been commented out or is missing. See also available actions.
如何把所以附件中"Attach:" 字段删除?
详见: Cookbook:AttachLinks 。
如何避免上传的文件名出现乱码问题? (例如 "Zażółć geślą jaźń.doc")?
详见:$UploadNameChars
= "-\w. !=+#";
# 允许感叹号、等号、加号和hash。
我的文件有8个字符的扩展名'abc.pptx'?
详见:上传类型。
如何防止图片被盗链?