Skip to Content
BuildcordDocs

Save a file

Keep an uploaded file in your bot's files, at an address that doesn't expire.

data.file saves a file in your bot's files, where you see it under Files in the builder, and gives later steps its address. Discord's address for something uploaded to a form stops working after about a day. The saved file's address keeps working, so you can store it in a collection, show it in an embed or attach it to a message later. When a flow saves a file someone uploaded with a command or a form in a variable or a collection, it's kept in your bot's files this way on its own.

Settings

SettingWhat it does
FileThe file's address, such as {modal.screenshot} from a form's file upload, or {fetched.attachment}. Up to 10, one per line.
NameWhat to call it in your files, such as vouch-{user.id}. Without an extension it keeps the file's own, so vouch becomes vouch.png. Empty keeps the file's own name. A name that's taken gets (2) after it.

Ways out

Way outWhen
SavedEvery file was saved.
Not savedThere isn't room in your storage, a file is bigger than 10 MB, it couldn't be fetched, or the bot saved too many files this minute. {file.error} says which.

Produces

TokenValue
{file.url}The saved file's address. With several, one per line, the same way Attach files takes them
{file.name}Its name in your files, one per line
{file.size}How big, in bytes, all of them together
{file.count}How many were saved
{file.error}Why it wasn't saved, on the Not saved way

Limits

Saved files count against the storage of the bot owner's account, the same as files you upload yourself:

  • Free: 150 MB.
  • Paid: 3 GB.

A file can be 10 MB at most, and a bot can keep 2,000 files. A bot can save 30 files a minute.

Notes

  • Anyone who can use the flow can fill your storage. Put a Cooldown or a Role check before this step on a public form.
  • Deleting a file in the builder stops its address working, so messages that show it lose the picture.
  • A test run doesn't save anything. {file.url} holds the address it was given.

Example

A vouch form has a file upload labelled Screenshot. After it's sent, save {modal.screenshot} named vouch-{user.id}, add a row to a vouches collection with {file.url}, and reply with an embed whose Image is {file.url}. A /vouches command can show the picture weeks later.

Was this page helpful?