Marc
TTCTheo's Typesafe Cult
•Created by Marc on 5/21/2024 in #questions
Uploading files remain in the uploading state.
Hello, I am really confused why all of my uploads are in the upload state. Is there another way to attach the files I wish to upload to uploadThing?
const customId = uuidv4();
const fileData = {
files: [
{
name: file.name,
size: file.size,
type: file.type,
customId: customId,
},
],
acl: "public-read",
metadata: null,
contentDisposition: "inline",
};
try {
const response = await fetch("https://uploadthing.com/api/uploadFiles", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Uploadthing-Api-Key": "sk_live_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"X-Uploadthing-Be-Adapter": "express",
"X-Uploadthing-Fe-Package": "@uploadthing/react",
"X-Uploadthing-Version": "6.4.0",
},
body: JSON.stringify(fileData),
});
const customId = uuidv4();
const fileData = {
files: [
{
name: file.name,
size: file.size,
type: file.type,
customId: customId,
},
],
acl: "public-read",
metadata: null,
contentDisposition: "inline",
};
try {
const response = await fetch("https://uploadthing.com/api/uploadFiles", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Uploadthing-Api-Key": "sk_live_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"X-Uploadthing-Be-Adapter": "express",
"X-Uploadthing-Fe-Package": "@uploadthing/react",
"X-Uploadthing-Version": "6.4.0",
},
body: JSON.stringify(fileData),
});
3 replies