-
Notifications
You must be signed in to change notification settings - Fork 25
upload multipart form data #29
Comments
same question..
does not send the file |
encode file to base64 works, but only if filesize is under 30kb, why? |
You could try to cast the image to a blob data type. But I am not sure if it will work. |
Hello everyone, you should be able to send multipart form data just like in it mentions putting formData vartiable into const formData = new FormData()
formData.append('avatar', avatar)
formData.append('model', model)
formData.append('id', id)
$fetch('/avatar', {
method: 'POST',
body: formData,
headers: { 'Content-Disposition': formData }
}) Please do let me know if this works. As I'm working on major release of this package and this totally should be topic mentioned in future documentation. Thanks |
yes, this works! thank you! |
Its not working this side. Below is my sample code
The return status from the server is Status 419. |
Hello @noprobz09, const { $apiFetch } = useNuxtApp()
//.... your code
const response = $apiFetch('/api/v1/attachments', {
method: 'POST',
body: formData,
headers: { 'Content-Disposition': formData }
}) Please let me know if it helped. |
Is there a sample of how to upload a file with multipart form data header? Thanks!
The text was updated successfully, but these errors were encountered: