# Upload and save files

Binary files can be uploaded and attached to records via file-list fields.

```
// get all deals with 1000+ sum from CRM workspace and attach invoices to them
async function attachInvoicesToBigDeals() {
  const allDeals = await getBigDeals();
  for (const deal of allDeals) {
    const filePath = `${__dirname}/_files/${deal.id}.pdf`;
    if (!fs.existsSync(filePath)) continue;
    deal.transition = "edit";
    deal.attachments = [
      {
        file_uid: fileUid,
        id: fileUid,
        pending: true,
        title: `Invoice for ${deal.id}.pdf`,
      },
    ];
  }
  await comind.records.save(allDeals);
  console.warn(`Saved ${allDeals.length} deals with attachments`);
}
```
