[pmwiki-users] Direct me to a Cookbook that uses markup that takes an uploaded attachment as a parm

Petko Yotov 5ko at free.fr
Sun Apr 2 13:10:58 CDT 2017


On 31/03/2017 17:29, ccox at endlessnow.com wrote:
> I wanting to do something in a recipe in php that takes in an argument
> of Attachment or Group/Attachment or Group/Page/Attachment
> 
> In particular needs to support the latter (down to uploads per
> page).  I just want to make sure I code it "right".

There are cookbook recipes but wouldn't you rather study from the 
original?

The scripts/upload.php file has the function LinkUpload().

Its $path argument contains File.ext or Group/File.ext or 
Group/Page/File.ext or even Group.Page/File.ext.

Look how $pagename is derived from that, and $filepath becomes the 
actual path to the disk file if you need to manipulate it. At the end, 
$path becomes the URL to the file that will be sent to the browser.

Petko




More information about the pmwiki-users mailing list