I have an “uploadButton” on my site, but it only allows to upload directly to the wix media manager. I want access to the file content in my code to upload it to AWS S3.
Is there any way with Wix to get a file content from the user in the code?
In this case you will first need to upload the file on the Wix Media Manager then get the public URL for the file which you can then upload to your AWS S3 bucket.
You will need to use something like Node Fetch or Wix Fetch itself to create a buffer from the URL and then upload it to S3 using the following parameters
var params = {
Bucket: bucket_name,
Body: buffer, //
Key: `images/wix_image02.png` //path and file name
};
@magenheim The startUpload() function gives you a **mediaId** - use that to call Wix Media Backend’s getFileUrl() function which will give you a public link to that file.
Currently you cannot delete the file from the Wix Media Manager with code, its a requested feature so please vote for it if you want to see Wix develop it faster.