How to upload a file to a folder in media manager

Question:

on UI, i have 3 items.

  1. a text field that will take a folder name from the user
  2. a “uploadButton”
  3. submit button.

Users can first type a folder name, select a file using uploadButton and then click “submit” button. once submit is clicked, the logic should create a folder on the media manager and upload the selected file to the same folder.

Product:
[Wix Studio Editor]

This logic will require custom code.

This API should help:

Yes, it would require a custom code.
but, once I have the upload URL with the API you mentioned, how do I upload the file to this?
uploadButton only returns the filename.

Using this API, you can set the parentFolderId to the ID of the folder that you want the files to be uploaded to.

Thanks Pratham,
I have seent his API, the file can be uploaded using this “upload URL” with POST method.
The problem is, I don’t know how to read the file content ( binary )which is selected by “uploadButton”. There are other APIs as well, but they also expect binary to be passed, and I don’t know how to read the binary from “uploadButton”.