Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
Upload a File to Your Org
This simple example shows how to upload the file called astro.png to an org with the alias new-scratch-org:
1sf data create file --file astro.png --target-org new-scratch-orgBy 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:
1sf data create file --file astro.png --title "Astro Running" --target-org new-scratch-orgBy 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:
1sf data create file --file astro.png --parent-id 003O300000WLdtwIAD --title "Astro Running" --target-org new-scratch-org