By Paul
By using custom file fields, you can have you visitors upload several files at once for a single object. For listings and comments this isn't so important since you can already let people upload any number of files, but you can also add file uploads to categories and members using custom file fields.
In order to get started on creating a custom file field, visit customizations -> 'add fields' in your admin panel. Any field which you give a name that includes 'attach' in it will automatically become a custom file field, but if you do not wish to worry about this just select 'file' from the type options and it will automatically append 'attach' to the name you give it. Once you click 'add field' you will be told what template changes you need to make to your submission and editing tempalates, or if templates are chmoded the changes will be made for you.
Now that you have the custom file field working, you'll want to make use of it in the display (most likely in the 'show listings in category' and/or 'main index' templates for a category, or the profile for a member). Here's a reference of the template variables you will have available for such display... replace 'CUSTOMATTACH' in each example with the uppercase version of the name of your custom file attachment field. These examples assume it's a category field, replace {CAT with the appropriate prefix if it's another type of field.
{CATCUSTOMATTACHTITLE} - The name of the file for display purposes (the same name it had on the computer of the person who uploaded it).
{CATCUSTOMATTACHNAME} - The actual name on disk of the file in the attachments directory.
{CATCUSTOMATTACHDOWNLOADS} - The number of times the file has been downloaded so far.
{CATCUSTOMATTACHFILESIZE} - The size, in bytes, of the file.
{CATCUSTOMATTACHKB} - The size, in kilobytes, of the file.
{CATCUSTOMATTACHWIDTH} - For images, the width of the image in pixels.
{CATCUSTOMATTACHHEIGHT} - For images, the height of the image in pixels.
{CATCUSTOMATTACHDOWNLOADURL} - A download url which you can put in an a href HTML tag for a link or an img tag to display an image.
{CATCUSTOMATTACHTHUMBURL} - A thumbnail url which you can put in an <img> HTML tag to display.
To conditionalize the display to only show when there's a file attached, use <IF {CATCUSTOMATTACHTITLE}> ... </IF> around it.
Some common examples of what you'll want to use as your display template code:
<IF {CATCUSTOMATTACHTITLE}>
Download Link: <a href="{CATCUSTOMATTACHDOWNLOADURL}">Download {CATCUSTOMATTACHTITLE}</a>
Direct display of an image: <img src="{CATCUSTOMATTACHDOWNLOADURL}" />
Thumbnail of an image: <img src="{CATCUSTOMATTACHTHUMBURL}" />
</IF>
Download Link: <a href="{CATCUSTOMATTACHDOWNLOADURL}">Download {CATCUSTOMATTACHTITLE}</a>
Direct display of an image: <img src="{CATCUSTOMATTACHDOWNLOADURL}" />
Thumbnail of an image: <img src="{CATCUSTOMATTACHTHUMBURL}" />
</IF>
Note: In all the examples above, replace CUSTOMATTACH and customattach with the name of the custom file attachment field you've added. If you're doing this for a listing field instead of a category field, replace {CAT with {LINK everywhere above... for a member field replace {CAT with {MEMBER.
For custom listing attachments, in some cases you may want to include them in the listing slideshow. If that's the case, edit your listing details template and add
<IF {LINKCUSTOMATTACHFILENAME}><option value="{LINKCUSTOMATTACHTHUMBURL}&thumbwidth=500&thumbheight=500">{LINKCUSTOMATTACHFILETITLE}</option>
(changing CUSTOMATTACH to whatever you name your field) right below
<select name="Oneslide" onChange="Onechange();">

Print
Rate
E-Mail