data create file

Upload a local file to an org.

This command always creates a new file in the org; you can’t update an existing file. After a successful upload, the command displays the ID of the new ContentDocument record which represents the uploaded file.

By default, the uploaded file isn’t attached to a record; in the Salesforce UI the file shows up in the Files tab. You can optionally attach the file to an existing record, such as an account, as long as you know its record ID.

You can also give the file a new name after it’s been uploaded; by default its name in the org is the same as the local file name.

Flag Name (Long)Flag Name (Short)Description
‑‑api‑versionN/AType: Value

Override the api version used for api requests made by this command
‑‑file‑fType: Value
Required

Path of file to upload.
‑‑flags‑dirN/AType: Value

Import flag values from a directory.
‑‑jsonN/AType: Boolean

Format output as json.
‑‑parent‑id‑iType: Value

ID of the record to attach the file to.
‑‑target‑org‑oType: Value
Required

Username or alias of the target org. Not required if the target-org configuration variable is already set.
‑‑title‑tType: Value

New title given to the file (ContentDocument) after it’s uploaded.

Upload the local file “resources/astro.png” to your default org:

Give the file a different filename after it’s uploaded to the org with alias “my-scratch”:

Attach the file to a record in the org: