-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
📝 Add generate upload url endpoint api doc
- Loading branch information
1 parent
918836d
commit 033f52e
Showing
11 changed files
with
432 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
title: 'Generate upload URL' | ||
openapi: POST /v2/generate-upload-url | ||
--- | ||
|
||
The `presignedUrl` and `formData` fields can be then used to upload the file to the S3 bucket, directly from the browser if necessary. Here is an example: | ||
|
||
```js | ||
// data contains the presignedUrl and formData fields from the response | ||
|
||
const formData = new FormData() | ||
Object.entries(data.formData).forEach(([key, value]) => { | ||
formData.append(key, value) | ||
}) | ||
formData.append('file', file) | ||
const upload = await fetch(data.presignedUrl, { | ||
method: 'POST', | ||
body: formData, | ||
}) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.