Sending File to api - Custom Boilerplate Integration

Hi, i'm trying to send a file to our backend. We're using the custom boilerplate integration. I'm accessing the file using
const handleFileChange = ($event) => {
if ($event.target.files && $event.target.files[0]) {
form.value.File = $event.target.files[0];
}
};
const handleFileChange = ($event) => {
if ($event.target.files && $event.target.files[0]) {
form.value.File = $event.target.files[0];
}
};
and sending the complete form to the composable. But in the api-client the files is not present anymore. I also tried this snippet:
const handleFileChange = ($event) => {
if ($event.target.files && $event.target.files[0]) {
const reader = new FileReader()
reader.readAsDataURL($event.target.files[0]); (or reader.readAsByteString($event.target.files[0])
reader.onload = () => {
const encodedFile = reader.result.split(",")[1];
form.value.businessRegistrationFile = encodedFile;
}
}
};
const handleFileChange = ($event) => {
if ($event.target.files && $event.target.files[0]) {
const reader = new FileReader()
reader.readAsDataURL($event.target.files[0]); (or reader.readAsByteString($event.target.files[0])
reader.onload = () => {
const encodedFile = reader.result.split(",")[1];
form.value.businessRegistrationFile = encodedFile;
}
}
};
But here i got 413 error. I think thats because the content now is around 4 to 7 MB. Do anyone have already implemented sth like this? Thanks in advance
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server