Uploads
Documentation > Concepts > Uploads
Boltwire takes a rather cautious approach to uploads, in an effort to protect your site from malicious scripts being sent up to your server. This tutorial gives a bit of information on the various settings available to you..
Site Config.
There are three settings in site.config you may wish to change related to uploads: uploadMode, uploadTypes, and uploadSize. By default, BoltWire sets the upload mode to true. To block uploads sitewide, simply set this to false. The default upload types are listed below. To allow other kinds of uploads, just add them to the list. Only, be careful what you allow! And the allowed size by default is 25k (pretty small). You may wish to increase this to a larger size if you will be uploading bigger files.
Here is what a default site.config page should have:
<code>
uploadMode: true
uploadSize: 25000
uploadTypes: gif,jpg,png,txt,pdf
</code>
2. Authorization. In addition to enabling uploads, users must be authorized to upload. The security page at site.auth.uploads, basically contains only one line: "*: ". This means essentially, uploads on all pages are allowed for nobody (except super admins). You can change this setting by allowing users of your choice to upload files on the pages of your chooice.
For example, changing it to:
<code>
*: @editors
sandbox: @guest
gallery*: @member
</code>
means editors can upload everywhere, guests can upload stuff via the sandbox (not a wise move) and members (anyone logged in) can upload into any page in the gallery hierarchy. Of course once an image is uploaded, it can be displayed anywhere by a normal image link.
3. Finally, you need to enable viewing of the upload action, by going to site.auth.view and adding
<code>action.upload: @member</code>
Or some other value as desired. That should about do it!
Upload Markups
Once you have your settings adjusted properly, things should work intuitively. To upload a graphic called graphic.jpg, just put the markup [^graphic.jpg^] on a page, and click save. The markup generates a link to the upload action if the file doesn't exist. Click it, and you will be given an option to upload the file. If the file exists, it will be rendered either as the actual image (if a jpg, gif, or png), or a link for a downloadable file (other types).
You can also upload files directly using action.upload without putting them on a page anywhere. And once a file is uploaded you can link to it from anywhere in the site, using the markup described above.
You can also put any of the following attributes in your image tags: align, alt, border, class, height, width, hspace, vspace, style, title. More info can be found at Images
If you want to organize your files a bit better, you can even store them in subdirectories, by doing following which puts the graphic in files/test.
<code>graphic.jpg?</code>
How To
How to display pictures which were uploaded?
Please refer to Search.
How to get uploads working with CleanURLs?
Add a line like this to your htaccess file:
RewriteCond % !files/(.*)\.
Please refer to CleanURLs.
There was no site.auth.uploads file in my options. I created one, pasted what you had in quotes, but it didn't take it. I closed the final space, and it took that, but following the other instructions, I must have done something wrong. Never got the uploads action to show up in the view. Hmm.

