Merge pull request #43 from payloadcms/fix/add-file-to-local-operations

fix: add file to create and update local operations
This commit is contained in:
James Mikrut
2021-02-05 15:16:03 -06:00
committed by GitHub
12 changed files with 128 additions and 4 deletions

View File

@@ -96,6 +96,11 @@ const post = await payload.create({
// If creating verification-enabled auth doc,
// you can optionally disable the email that is auto-sent
disableVerificationEmail: true,
// If your collection supports uploads, you can upload
// a file directly through the Local API by providing
// its full, absolute file path.
filePath: path.resolve(__dirname, './path-to-image.jpg'),
})
```
@@ -152,6 +157,11 @@ const result = await payload.update({
user: dummyUser,
overrideAccess: false,
showHiddenFields: true,
// If your collection supports uploads, you can upload
// a file directly through the Local API by providing
// its full, absolute file path.
filePath: path.resolve(__dirname, './path-to-image.jpg'),
})
```