$fileUpload[]
$fileUpload writes a file that belongs to this bot (no other bot can read it) in the storage of the account that owns the bot. It counts against the account storage quota (included files of the plan plus storage packs). A file is at most one tenth of the account storage quota, between 25 MB and 200 MB. Writing to an existing path replaces it.
Syntax
$fileUpload[path;content;(encoding);(contentType)]
On desktop, a bot that runs locally writes in a folder of the computer instead, with the same rules (and no quota).
Parameters
| Parameter | Description |
|---|---|
path |
Required. Logical path such as exports/week-12.csv: segments separated by /, 255 bytes at most, no .., no empty segment, no leading or trailing /. |
content |
Required. The text to write, or base64 when encoding is base64. |
encoding |
Optional. utf8 (default) or base64. |
contentType |
Optional. MIME type, for example image/png. Defaults to application/octet-stream. |
Errors
Use $try to catch them: file_too_large, file_quota_exceeded, file_invalid_path, file_invalid_encoding, files_unavailable (the bot does not run on a runner nor on desktop).
Examples
$fileUpload[notes/$authorID.txt;$message[1]]
Saved.
Try it
Paste an example into the playground to preview its message (functions that act on Discord are not run), or build the same thing with blocks.