|
UploadExtended<< | Cookbook-V1 | >> Note: The recipes here are for PmWiki versions 0.6 and 1.0 only. For PmWiki 2.0 recipes, see Cookbook. The goal of this module is to extend the upload functionality in the following ways:
Structure of upload directoryThe standard structure of the upload area is as follows: uploads/ |-- Group1/ | `-- aFile.txt |-- Group2/ ... where the root directory of the upload area is set by the variable This module allows you to upload files to subdirectories, as well as store files directly in uploads/ |-- at-top-level.txt |-- Group1/ | |-- aFile.txt | `-- dir1/ | `-- dir2/ |-- Group2/ | `-- dir1/ ...
SolutionThe solution has been implemented as a replacement for the original upload module,
The development of this directive takes place at http://www.lyx.org/~chr/attachlist/pmwiki.php?pagename=Main.HomePage, and the very latest (development) version can be found at http://www.lyx.org/~chr/demo/pmwiki.php?pagename=Upload.Installation. PathsFrom a safety aspect, it is critical that this module does not allow
users to access files or directories outside the upload area. For that
reason, the code separately checks that a path does not contain
'
CompabilityThis module used to require PmWiki 0.5.27 or later, but has been updated to work with 0.6.7. It is therefore unknown if it still works with 0.5.27 or later.
The original requirement for 0.5.27 was based on See AlsoThese links cover the old functionality; please familiarize yourself with at least the page uploads first.
Installation
Warning: This module maybe disable local control of uploading files, since it is possible to upload (or list) files to any group from any page. Examples of using
|
|
Attach statement |
Equivalent file path |
Attach:aFile.txt |
/$Group/aFile.txt |
Attach:subDirectory/aFileInSubdirectory.txt |
/$Group/subDirectory/aFileInSubdirectory.txt |
Attach:/at-top-level.txt |
/at-top-level.txt |
Attach:../at-top-level.txt |
/at-top-level.txt |
Attach:/Upload/aFile.txt |
/Upload/aFile.txt |
Attach:/AnotherGroup/aFileInAnotherGroup.txt |
/AnotherGroup/aFileInAnotherGroup.txt |
Attach:../AnotherGroup/aFileInAnotherGroup.txt |
/AnotherGroup/aFile.txt |
[[attach:]]You can now use e.g.
[[attach:aFile.txt]]
instead of Attach:aFile.txt. The difference is that the former allows you to have spaces in the filename, and is rendered without the text Attach:
[[Attachlist:]]Here are some examples to illustrate using the new directive [[Attachlist:]].
|
Source code |
Directory listed (incl. any subdirectories) |
Attachlist:? |
|
Attachlist:subDirectory? |
|
AnotherGroup? |
attachements to the group |
You can use [[attachlist:]] instead of [[Attachlist:]]
Below is a description of the syntax of the upload directives. It uses an extended BNF, see syntax notation? for a description of the extended BNF that is used.
attach-statement ::= ( Attach: upload-path upload-name ) | ( attach: upload-path upload-name1 ? ) attachlist ::= ( Attachlist: upload-path [+ws attachlist-sort *ws] ? ) | ( attachlist: upload-path [+ws attachlist-sort *ws] ? ) attachlist-old ::= [[$Attachlist [+ws attachlist-sort *ws] ]] attachlist-alt ::= [[$Attachlist: upload-path [+ws attachlist-sort *ws] ]] upload-path ::= ?/ *( +upload-char /) upload-char ::= upload-char-allowed | ~upload-char-disallowed upload-char-allowed ::= . | + | - | _ upload-char-disallowed ::= punct | cntrl | ws upload-name ::= +upload-char upload-name1 ::= +( upload-char | ws )
Note that upload-path may be empty and that upload-char is any
character in upload-allowed-punct, or any character not in
upload-char-disallowed. The syntax of the optional argument
attachlist-sort is as follows:
attachlist-sort ::= attachlist-sort-by '=' attachlist-sort-order
attachlist-sort-by ::= attachlist-sort-by-name |
attachlist-sort-by-size |
attachlist-sort-by-modification-time
attachlist-sort-by-name ::= n | N
attachlist-sort-by-size ::= s | S
attachlist-sort-by-modification-time ::= m | M
attachlist-sort-order ::= attachlist-ascending | attachlist-descending
attachlist-ascending ::= a | A
attachlist-descending ::= d | D
[[attach:]] and [[attachlist:]] -- essentially as synomyms, but spaces now work in the filename thanks to Wayne.
-l for locally, or do it the other way around: require -R in order to recursively list subdirectories. -- Christian
$UploadCharPattern as follows:
attachlist ::= [[Attachlist: upload-path upload-file-filter [+ws attachlist-sort *ws] ]] upload-file-filter ::= *(upload-char | * | ?)
[[Attachlist:somDir/*.txt]] --Christian
<#>? — inspired by ls in Unix systems
<#>? — inspired by DOS
<#>? — a bit more explicit
$Attachments:? — that's what it is...
local/localmap.txtiles:? —
action=browsedir and BrowseDir: — ideas for the futureI'd like to do something like this:
[[attachlist:someDir/ --non-recursive --browsedir]]
where subdirectories should show up as links, which when you click on them automatically lets you browse the directory you clicked on. One way of doing that is to implement a 'action=browsedir' but I want to remember which page the user came from so that he can return to it.
Anyway, this is for the future... I'm pretty busy right now since I've just started on a new job. /Christian PS. If I introdce an 'action=browsedir', I should probably also introduce a directive '<#>?' or 'BrowseDir:someDir/' which produces a link that when you click on it moves you to the browsing mode.
Probably GPL, since this is based on the original upload.php
pmwiki-2.2.0-beta68 -- Last modified by {{}}?