Why is axios not allowing to attach a File object in the PUT method body? #6493
krishmarsonia
started this conversation in
General
Replies: 1 comment 6 replies
-
If you want to upload file try use const form = new FormData();
form.append('file', FileObject);
axios.put(form); |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am working on a next.js project, where I have to upload an image/video in the S3 bucket through Pre-signed URL. In every video/blog/article everyone is saying to append the file in the body. But, I am unable to do so, as axios is giving me an error of Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream, I have done many things to resolve this issue, I have created ArrayBuffers, I have created streams of the file, but nothing was of any use. Then I tried it with fetch API and it worked magically in the first time only. Is there any solution for this problem?
Beta Was this translation helpful? Give feedback.
All reactions