nextjs-gcp-storage icon indicating copy to clipboard operation
nextjs-gcp-storage copied to clipboard

Tracking upload progress on the client?

Open nakamigo opened this issue 4 years ago • 1 comments

Hello! Thanks to the tutorial! Is it possible to update a client on upload progress?

nakamigo avatar Oct 09 '21 11:10 nakamigo

Yup, of course. You can use axios for built-in feature for this using onUploadProgress.

Example:

axios.post(url, formData, {onUploadProgress: (progressEvent) => {
     const progress = Math.round((progressEvent.loaded / (progressEvent.total as number)) * 100);
     console.log("progress:", progress);
    },
})

ImBIOS avatar Dec 07 '22 14:12 ImBIOS