data create file

<!-- prettier-ignore-start -->

Upload a local file to an org.

Description for data create file

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.

Flags

Flag Name (Long) Flag Name (Short) Description
<code>‑‑api‑version</code> N/A Type: Value<br><br>Override the api version used for api requests made by this command
<code>‑‑file</code> <code>‑f</code> Type: Value<br>Required<br><br>Path of file to upload.
<code>‑‑flags‑dir</code> N/A Type: Value<br><br>Import flag values from a directory.
<code>‑‑json</code> N/A Type: Boolean<br><br>Format output as json.
<code>‑‑parent‑id</code> <code>‑i</code> Type: Value<br><br>ID of the record to attach the file to.
<code>‑‑target‑org</code> <code>‑o</code> Type: Value<br>Required<br><br>Username or alias of the target org. Not required if the target-org configuration variable is already set.
<code>‑‑title</code> <code>‑t</code> Type: Value<br><br>New title given to the file (ContentDocument) after it's uploaded.

Examples for data create file

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

sf data create file --file resources/astro.png

Give the file a different filename after it's uploaded to the org with alias "my-scratch":

sf data create file --file resources/astro.png --title AstroOnABoat.png --target-org my-scratch

Attach the file to a record in the org:

sf data create file --file path/to/astro.png --parent-id a03fakeLoJWPIA3
<!-- prettier-ignore-end -->