socketio-file-upload
socketio-file-upload copied to clipboard
How to upload a file in base64 format?
Hi, currently there are methods available only for file input. Is there any way to upload base64?
You can convert your base64 to an ArrayBuffer
, which you can convert to a Blob
, and then you can pass an array of Blob
to the submitFiles()
function. You may want to set some additional properties on the Blob
to make it behave more like a File
object.
Something like this should work:
const blob = new Blob(yourArrayBuffer, { type: "image/png" }); // set your own MIME type
blob.name = "example.png";
blob.lastModified = new Date().valueOf();
siofu.submitFiles([blob]);
Hello, it worked like a charm, thank you so much!!
How to upload large files using this method. With chunk size.