Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to upload a file in base64 format? #128

Open
ishan501 opened this issue Oct 22, 2021 · 3 comments
Open

How to upload a file in base64 format? #128

ishan501 opened this issue Oct 22, 2021 · 3 comments
Labels

Comments

@ishan501
Copy link

Hi, currently there are methods available only for file input. Is there any way to upload base64?

@sffc
Copy link
Owner

sffc commented Oct 22, 2021

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]);

@ishan501
Copy link
Author

Hello, it worked like a charm, thank you so much!!

@anand-010
Copy link

How to upload large files using this method.
With chunk size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants