[pmwiki-devel] Working with uploads / attachments / $UploadPrefixFmt

Steven Leite steven_leite at kitimat.net
Mon Mar 21 22:21:51 CDT 2011


I'm writing an image gallery recipe.

Part of what it does is reads an existing wiki pages and isolates any 
lines that contain "Attach:".

Once the lines are isolated, it extracts the file name by taking 
everything after Attach: but before .jpg to determine the path of the file.

*The problem *is that if a user has changed the default value of 
$UploadPrefixFmt to use slashes instead of dots (for example), or the 
user has enabled Per Page attachments instead of Group attachments, the 
script breaks.

I need a way to determine the upload path (or URL) to the image when 
given nothing more than what is on the wiki page (Eg.  Attach: 
Group/Name/File.jpg)

Another problem which I foresee happening is what if a user specifed 
Attach:File.jpg without specifying the Group or Page name where the 
image is to be stored?  That's another problem, but I haven't got to 
that bridge yet.

I suspect I need to use the FmtPageName or some similar function, but 
I'm not really sure.

Thanks in advance!

S Leite
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-devel/attachments/20110321/44aed0c7/attachment.html>


More information about the pmwiki-devel mailing list