[pmwiki-users] Inserting files from the local file system

Petko Yotov 5ko at free.fr
Sat Apr 7 22:51:01 CDT 2007


On Sunday 08 April 2007 04:47, Steven Benmosh wrote:
> Two questions/problems I am running into:
>
> 1. I have pmwiki set up in my web server root. I have a directory called
> "images", with image files in it, including one called "SantaBarbara.jpg".
>
> I would like to attach the image to a wiki page. I can do it by linking to
> the actual url of the file, in the form
> http://my.web.site/images/SantaBarbara.jpg. I am wondering if there is a
> simpler way to connect to a local file, maybe with a relative link, without
> having to type the whole url and create a static link (that would not
> change if I move the wiki to another site)?

Yes, you can use a "Path:" link to point to files on the server, but that are 
not on the wiki uploads directory structure:

   Path:/images/SantaBarbara.jpg

If the link ends with .jpg, .gif or .png, it will be considered as an inline 
image. To add a tooltip title, use 
   Path:/images/SantaBarbara.jpg"View from Santa Barbara"

To only link to the file, use
   [[Path:/images/SantaBarbara.jpg|this is a link]]

This way you can also link to other files on the same website, like old HTML 
pages. See also:
   http://pmwiki.org/wiki/PmWiki/InterMap




>
> 2. For some reason the Attach markup does not work for me - maybe because I
> did not allow attachment by authors, which is intentional. I tried the
> following, and each gives me a text result, not the image file:
>
> Attach:"/images/SantaBarbara.jpg"
> Attach:"images/SantaBarbara.jpg"
> "Attach:images/SantaBarbara.jpg"
> "Attach:/images/SantaBarbara.jpg"

Use Path: markup like above. Attach: works only for files "attached" to a page 
like this:
   Attach:SantaBarbara.jpg              #attached to the current page
   Attach:OtherPage/SantaBarbara.jpg    #attached to OtherPage
   Attach:OtherGroup./SantaBarbara.jpg  #attached to OtherGroup, note the "."
   Attach:OtherGroup.Page/SantaBarbara.jpg #attached to Page in OtherGroup

>
> Is there a way to allow attachments without allowing uploads? I want access
> to the uploads to be through ftp or scp, not via pmwiki.

Yes. there is. You can enable uploads but set an invalid password like this:
   $EnableUploads = 1;
   $DefaultPasswords['upload'] = '*';

This way the uploads functions are loaded, but because of an invalid/blocked 
uploads password, noone can upload files. (The password in not "*", it is 
just blocked.)

However, being able to quickly attach a file through HTTP is a really really 
usefull feature, so you may consider alowing uploads at least to yourself. To 
do this, set a real uploads password like this:
   $EnableUploads = 1;
   $DefaultPasswords['upload'] = crypt('mysecretpassword');

Or, you can tell PmWiki to allow uploads only to the administrator:
   $EnableUploads = 1;
   $DefaultPasswords['admin'] = crypt('mysecretpassword'); # admin pw
   $HandleAuth['upload'] = 'admin'; # use admin pw for uploads

Enjoy,
Petko







More information about the pmwiki-users mailing list