Newer Version Available
Upload a File to Your Org
Use the data create file CLI command to upload a
local file to your org. The file is uploaded to the ContentDocument standard object; when the
command finishes it outputs the new record ID. In the Salesforce UI, the uploaded file is
available from the Files tab. The command always creates a new file in the org; you can’t update
an existing file. If you create a file with the name of an existing file, a new duplicate record
is created.
This simple example shows how to upload the file called astro.png to an org with the alias new-scratch-org:
By default, the Title field of the new ContentDocument record is the same as the name of the file (without the extension). In the example, the title is astro. Use the --title flag to give it a new title:
By default, the uploaded file isn’t attached to a Salesforce record, such as an account or contact. If you know the ID of the record to which you want to attach the uploaded file, specify it with the --parent-id flag. This example attaches the file to a contact because the ID starts with 003: