Gets an upload URL for uploading a file to the media manager.
The getUploadUrl()
function returns a Promise that resolves to an object
containing an upload URL.
Use the getUploadUrl()
function to allow an external client to upload a single file to your
site's Media Manager.
Note:
The upload URL is valid for a single file upload and expires after 1 day. The getUploadUrl()
function must be called for each file that you want to upload.
The external client uploads a file by sending a POST or PUT request to the
URL returned by getUploadUrl()
using multipart/form-data encoding and
sending the following data:
1
upload_url
: The returned upload URL.
file
: An object containing:
value
: The file content as a multi-part value.
options
: An object containing:
filename
: The name of the file as it will appear in the Media Manager.contentType
: The content type of the file.The POST or PUT request returns the following:
1
To get a Wix image URL that can be stored in a collection or displayed in an image element or gallery from the above object, use the following expression:
1
The path within the Media Manager where the file will be uploaded. If the path doesn't yet exist, the missing folders will be created.
Options to use when uploading the file.