Quickly upload something without UploadButton/UploadDropzone

Hey everyone - I have an image that I want to upload directly into UploadThing. It's not the user inputting an image via button or dropzone but rather just me taking an image the user has already inputted, making it transparent, and then uploading that image into UploadThing. What would be the best way to accomplish this functionality? I was trying UT API but not too much luck with that
2 Replies
Eve
Eve3mo ago
import { UTApi } from "uploadthing/server";

const utapi = new UTApi();
const file = new File(["./README.md"], "README.md");
const response = await utapi.uploadFiles([file]);

console.log(response);
import { UTApi } from "uploadthing/server";

const utapi = new UTApi();
const file = new File(["./README.md"], "README.md");
const response = await utapi.uploadFiles([file]);

console.log(response);
ayushagarwal
ayushagarwalOP3mo ago
Thanks!!
Want results from more Discord servers?
Add your server