Hello,
I have been trying to upload files that I’ve kept in Wix site, to upload to an API via HTTP POST, but I have never been able to get the file.
I have tried the following (inside the commented body tag) in the backend code. None of these work.
import { fetch , getJSON } from “wix-fetch” ;
const response = await fetch (“DESTINATION_API_URL”, {
method : ‘post’ ,
headers :
{
“Content-Type” : “multipart/form-data”
},
//body: “file=//3ecc46f5-0587-47b7-84c8-ba92521d8841.usrfiles.com/ugd/3ecc46_f1263d7429664f47b6f63b8af1ceceb5.pdf”
//body: “file=https://3ecc46f5-0587-47b7-84c8-ba92521d8841.usrfiles.com/ugd/3ecc46_f1263d7429664f47b6f63b8af1ceceb5.pdf”
//body: “file=ugd/3ecc46_f1263d7429664f47b6f63b8af1ceceb5.pdf”
//body: “file=3ecc46_f1263d7429664f47b6f63b8af1ceceb5.pdf”
Basically, I just want to pass the local file into the “file” parameter. Can anyone help?
Thank you.