Attachments field

Upload files attached to the SharePoint list item, and print attached photos as pictures in the PDF report.

The Attachments field uploads files to the SharePoint list item using SP's built-in Attachments endpoint. Multiple files supported. The upload is a post-save writer, the item is created first, then the files attach.

For files that should live in a separate document library (with their own metadata), use the Document Library field instead.

Properties

PropertyDescription
label
string
default: Attachments
Visible label above the upload area.
accept
string
default: *
Accepted file types, passed to the file picker. MIME types or extensions, e.g. image/* or .pdf.docx.
maxFileSizeMb
number
default: 25
Per-file upload size cap in megabytes. The most you can set is 250, the largest file SharePoint accepts as a list item attachment. For bigger files use a Document library control, which takes files up to 2 GB and beyond.
allowMultiple
boolean
default: true
Allow more than one file. When false, only a single attachment can be added.
required
boolean
default: false
Require at least one attachment before the form can save.

In PDF reports

Photos attached to the item print in the form's PDF report as the pictures themselves, not as links. When you generate a report from a form, each Attachments field becomes an Attachments section titled with the field's label. You can also drag Attachments (photos) from the report designer's Media group onto any report.

  • Photos (JPG, PNG, GIF, WebP, BMP) print in a grid, two per row by default, each with its file name underneath. Photos per row, the largest photo height and the captions are set on the element.
  • Other files, such as a PDF or Word document, are listed by name below the photos.
  • Photos are shrunk before they go into the PDF, so a 3 MB phone photo adds roughly 200 KB and the emailed report stays a sensible size.
  • The report's own PDF, and earlier copies of it attached by previous saves, are never listed.
  • When the item has no attachments the section prints nothing, unless you choose to show a "No attachments" line instead.
  • The same section can print photos uploaded somewhere else on the form. Set Files from to one of the form's Document Library fields (the folder it uploads into) or a Linked list (the attachments on its rows).

Up to 30 photos (about 9 MB of pictures) print per report. Any beyond that are listed by name.

JavaScript recipes

Block save until a file is attached

f365.events.onBeforeSave(() => {
  const root = document.querySelector('.f365-attachments');
  const count = root?.querySelectorAll('.f365-attachments-body li').length ?? 0;
  if (count === 0) {
    f365.ui.showToast('Please attach at least one file before saving.', 'error');
    return false; // cancels the save, keeps the form open
  }
  return true;
});

Require an attachment only for a chosen category

f365.events.onBeforeSave(async () => {
  if (f365.field('Category').value !== 'Expense Claim') return true;
  const root = document.querySelector('.f365-attachments');
  if ((root?.querySelectorAll('.f365-attachments-body li').length ?? 0) > 0) return true;
  await f365.ui.showAlert('Expense claims must include a receipt attachment.');
  return false;
});

Confirm upload after a successful save

f365.events.onSave((itemId) => {
  f365.ui.showToast(`Saved item #${itemId} with attachments.`, 'success');
});

Related articles

  • Document Library field

    Browse and upload files to a SharePoint Document Library, with the folder structure and metadata that brings.

  • Signature field

    Canvas-based signature capture, finger, stylus, or mouse. Saves as a PNG image to a SharePoint Image column or the item's Attachments.

  • Save flow, what happens when the user clicks Submit

    The two-phase save pipeline, validation, primary write, then post-save writers for attachments, signatures, images, and child rows.