Converting String Encoded Images to Files to upload with UploadThing
In my app, I'm using a libary which handles files in a file manager as base 64 strings. Is there a practical way of uploading string encoded images with UT?
If not, here's what I've been trying (the rest of the code is basically the docs' default setup):
const url = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII="const f = new File( [new Blob([url.split(",")[1]!])], "a", { type: "image/png" },)const selectedFiles = Array.from([f])const result = await startUpload(selectedFiles)
const url = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII="const f = new File( [new Blob([url.split(",")[1]!])], "a", { type: "image/png" },)const selectedFiles = Array.from([f])const result = await startUpload(selectedFiles)