Uploads

Completes a direct external upload

POST
https://discourse.example.com/uploads/complete-external-upload.json

Completes an external upload initialized with /get-presigned-put. The file will be moved from its temporary location in external storage to a final destination in the S3 bucket. An Upload record will also be created in the database in most cases.

If a sha1-checksum was provided in the initial request it will also be compared with the uploaded file in storage to make sure the same file was uploaded. The file size will be compared for the same reason.

You must have the correct permissions and CORS settings configured in your external provider. We support AWS S3 as the default. See:

https://meta.discourse.org/t/-/210469#s3-multipart-direct-uploads-4.

An external file store must be set up and enable_direct_s3_uploads must be set to true for this endpoint to function.

Body

application/json
unique_identifierstringrequired

The unique identifier returned in the original /generate-presigned-put request.

Example
66e86218-80d9-4bda-b4d5-2b6def968705
for_private_messagestring

Optionally set this to true if the upload is for a private message.

Example
true
for_site_settingstring

Optionally set this to true if the upload is for a site setting.

Example
true
pastedstring

Optionally set this to true if the upload was pasted into the upload area. This will convert PNG files to JPEG.

Example
true

Response

200OKany

external upload initialized

Response fields application/json
idintegerrequired
urlstringrequired
original_filenamestringrequired
filesizeintegerrequired
widthintegerrequired
heightintegerrequired
thumbnail_widthintegerrequired
thumbnail_heightintegerrequired
extensionstringrequired
short_urlstringrequired
short_pathstringrequired
retain_hoursstring | nullrequired
human_filesizestringrequired
dominant_colorstring | null
thumbnailobject | null
Show child attributes
idinteger
upload_idinteger
urlstring
extensionstring
widthinteger
heightinteger
filesizeinteger
optimized_videoobject | null
Show child attributes
idinteger
upload_idinteger
urlstring
extensionstring
filesizeinteger
sha1string
original_filenamestring