Use Axios with NextJS 15 Server Action Function #6655
Unanswered
DonaldLouch
asked this question in
Q&A
Replies: 1 comment
-
I have also tried to add this to the files.forEach((file: string | Blob) => {
formData.append("file", file)
axios
.post(
uploadFileToS3(
formData,
s3Payload
),
{
headers: {
'x-ms-blob-type': 'BlockBlob',
},
maxContentLength: 2e10,
maxBodyLength: 2e10,
onUploadProgress: (event: any) => {
console.log("Hello from event", event)
setUploadProgress(Math.round((event.loaded / event.total) * 100))
}
}
).then((response) => {
console.log(response)
})
.catch((error) => {
if (error.response) {
console.log(error.response)
console.log("server responded")
} else if (error.request) {
console.log("network error")
} else {
console.log(error)
}
})
}) This will upload the content through the Server Action but won't run the rest of the operation such as |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was looking into using Axios with my NextJS 15 application to upload a file and have it display the upload progress! This would also include multi-file uploading and I would also love to figure out uploading large file! What my issue is now, figuring out if I could call a service action function within axios and call the
await uploadFileToS3(file, S3Payload)
function within my upload page 🤔?!Such as:
and my upload file is currently looking like this:
Thanks in advanced!
Beta Was this translation helpful? Give feedback.
All reactions