# Working with campaign files and file fields

URL: https://help.hubhus.com/kb/working-with-campaign-files-and-file-fields
Category: Campaigns & Lead Management / Files
Updated: 2026-09-28T14:40:58.199+00:00

Summary: Campaign files: Upload images/PDFs → get a public URL → use in email templates and pages via &lt;img src="URL"> or &lt;a href="URL"> . For files shared across all campaigns use Account → Web & Resources → Files instead. File fields: Create via + New file field - configure allowed file types, size limits, image dimensions, upload behavior, and access (public/login required). File fields appear in forms/webpages for customer uploads; files are stored per lead and accessible on the lead profile.

Campaign settings → Files contains two distinct features: **Campaign files** (assets used in emails/pages) and **File fields** (custom fields that allow leads to upload files through forms). Both are managed in the same place but serve different purposes.

## 4 things to know

1. **Campaign files (assets)**. Upload campaign-specific images, documents, and graphics via **Campaign settings → Files → + New file**. Set access: **Public** (for files in customer-facing emails/pages) or Private. Copy the file URL from the list and reference it in email templates or HTML pages. For files used across multiple campaigns (company logo, brand assets) use **Account → Web & Resources → Files** instead - campaign files are campaign-scoped only.
2. **Creating file fields (lead uploads)**. Create via **Campaign settings → Files → File fields → + New file field**. Configure: **Name**, **File types** (Image / Document / All), **Min/max file count**, **Min/max file size (kB)**, image dimensions (if image type), **Uploaded files require login** (yes = secure/private, no = public URL), web optimization (recommended: yes), versioning behavior on re-upload, and styling options (help text, drop zone, preview). File fields are automatically available in campaign forms, webpages, and the lead profile.
3. **Viewing uploaded files**. Files uploaded by a lead are shown on the lead profile page under the file field section - each file shows a thumbnail preview, filename, size, upload date, and who uploaded it. Manage visibility: **Hide on page** hides from campaign webpages, **Hide on form** hides from forms, **PII** marks as personally identifiable information for GDPR. Edit/delete settings via the orange edit icon in the field list.
4. **Using file fields in templates**. Reference uploaded files in email and SMS templates using a loop pattern: `@files(file-field-slug)` ... `@endforeach_file`. Inside the loop use `{file.name}`, `{file.url}`, `{file.size}`. Use the template editor's built-in **File examples** section for copy-paste-ready patterns. Test with leads that have actual uploaded files.

**Read more**

### File loop code examples

Use these patterns in email and SMS templates (replace `billeder-fra-opgave` with your file field slug):

```
Text list of uploaded files:
@files(billeder-fra-opgave) - {file.name} ({file.size} kB)
@endforeach_file
```

```
HTML with download links (in email):
@files(billeder-fra-opgave)
<a href="{file.url}">{file.name}</a><br>
@endforeach_file
```

```
Inline image preview (in HTML page):
@files(billeder-fra-opgave)
<img src="{file.url}">
@endforeach_file
```

Test with a lead that has actual uploaded files - empty file fields produce no output and no error.

### Troubleshooting

**Campaign file not displaying in email or page**

- Verify the file URL is correct - paste it into a browser to confirm it loads
- Check the file's access level: it must be set to **Public** for customer-facing content
- Confirm the file was not accidentally deleted from the campaign files list

**"Invalid type for file - Only 'image' files are supported" (or similar)**

The file field is configured to only accept a specific file type (e.g. Image), but the user is trying to upload a different type (e.g. PDF). Fix:

1. Go to **Campaign settings → Files → File fields**
2. Click the orange edit icon on the relevant file field
3. Change **File types** to the type(s) you need - options are: Image, PDF, Text, Microsoft Office (docx, xlsx, pptx), Microsoft Outlook Email (.msg)
4. Save. The field now accepts the new file type.

A file field can technically be configured to accept multiple file types, but it is recommended to use one field per type. The code used to display files on a webpage (e.g. `<img>` for images vs. `<a href>` for PDFs) differs by type - mixing types in one field makes templating more complex. If files are only used on the Hubhus lead profile page and not in custom pages or emails, a mixed-type field is fine.

**File upload fails - other reasons**

- Check the file size limit - the file may exceed the Max. file size (kB) configured on the file field
- Open the browser console for error details
- Test with a smaller or different file to isolate the issue

**Uploaded files not showing on the lead profile**

- Check the "Hide on page" setting for the file field - if checked, it hides the field from profile pages
- Verify the file was successfully uploaded (look for any upload error messages during submission)
- Refresh the lead profile page
- Check if the file field section is collapsed - click to expand it

## Related articles

- https://help.hubhus.com/kb/how-do-i-create-custom-fields
- https://help.hubhus.com/kb/account-files-shared-assets-and-replaceable-urls
- https://help.hubhus.com/kb/campaign-forms-creating-lead-capture-forms
- https://help.hubhus.com/kb/working-with-the-template-editor
- https://help.hubhus.com/kb/how-do-i-set-up-checklists
