Not logged in. · Lost password · Register
Forum: General Help and Support Plugins RSS
Bureaucracy - image upload and display
hj #1
Member since Apr 2008 · 186 posts · Location: Lancaster, UK
Group memberships: Members
Show profile · Link to this post
Subject: Bureaucracy - image upload and display
Using Bureaucracy I've got a form which includes a file upload for images. Form code is...

file "Upload file" !

This works fine and uploads a file to media.

But there's no example on the Bureaucracy plugin page of how to code the template/placeholder to call an uploaded file, either as a link to or actual display of the image.

Using **Upload file** as a placeholder doesn't work. So what code or syntax should be used?

hj #2
Member since Apr 2008 · 186 posts · Location: Lancaster, UK
Group memberships: Members
Show profile · Link to this post
Well, I've kind of solved this myself, but with the previous help of user 'pop' - thanks, pop.

As previously mentioned, the form code for uploading a file is:

file "Upload file" !

In my usage, I actually want three upload functions, so the code is:

file "Upload file 1" !
file "Upload file 2" !
file "Upload file 3" !

This produces three upload 'buttons' if you like to call them that (browse for the file you want to upload and then submit it). All good, and in use the file(s) get uploaded to the media folder.

After a lot of experimentation, I found this was the necessary code to use in the template in order to display a link to the uploaded file - in my case I need lines for, potentially, 3 uploaded files:

**Attachment:** {{@@Upload file 1@@?linkonly}}\\
**Attachment:** {{@@Upload file 2@@?linkonly}}\\
**Attachment:** {{@@Upload file 3@@?linkonly}}\\

That works fine if you select and upload a file.  If, however, you only wanted to upload one file, but your form has three upload buttons, that means two upload functions are not utilised. But they are still part of the template code.  This results in a rather ugly 'null' link in the form of a typical wiki link to a page not yet created.  (see image)

It's understandable why this happens, I guess, but it's just not what you really want to see!  I experimented with putting..
|none various locations inside and outside the link, but could never get a satisfactory result.  For the timebeing I'll live with the ugly null links, but if anyone (author?) knows of a better, cleaner way of not displaying links where no file has been uploaded, I'd love to know.

Hope this helps others.

The author has attached one file to this post:
snip1.jpg 10.4 kBytes
You have no permission to open this file.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2020-04-06, 05:12:35 (UTC +02:00)