Hello, I have a question now.
It's just that when I try to upload a signature to Baserow, I don't know how to stuff the data into the body of the query.
The signature does not provide a File attribute and I am trying to convert the base64 to a File object but I am having other problems.
function sign2File(base64) {
let b = atob(base64),
bLen = b.length,
bArr = new Uint8Array(bLen);
while (bLen--) {
bArr[bLen] = b.charCodeAt(bLen);
}
return new File([bArr], "sign.png", { type: "image/png" });
}
await upload.trigger({
additionalScope: {
file: sign2File(signature.value),
},
});
The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received undefined
Or maybe I do.
await upload.trigger({
additionalScope: {
file: atob(signature.value),
},
});
error: "ERROR_INVALID_FILE", detail: "No file has been provided or the file is invalid."
Or
await upload.trigger({
additionalScope: {
file: { data: atob(signature.value) },
},
});
error: "ERROR_INVALID_FILE", detail: "No file has been provided or the file is invalid."
How do I convert it to meet my needs?
By the way, I used Baserow's built-in upload function and only saw that he uploaded a very simple formData
.