HeadlinesBriefing favicon HeadlinesBriefing.com

AWS S3 Large File Upload Lessons

DEV Community •
×

A recent project involving large file uploads to AWS S3 revealed limitations of browser-based uploads and the necessity of multipart uploads for reliable progress tracking. For files under 20MB, the onUploadProgress callback in Axios worked effectively. However, with larger files, progress tracking became unreliable as browsers send the file in a single request, leading to lagged or jumped progress. This issue underscores the challenges of handling large data transfers over the web.

To address this, the solution involved splitting files into chunks, a technique known as multipart upload. Each chunk is uploaded separately, allowing for more precise progress tracking and the ability to retry failed chunks individually. This approach not only makes uploads more predictable but also enhances user experience by providing stable progress indicators.

The backend workflow for multipart uploads was also updated to return a set of URLs for each chunk, along with an uploadId and ETags to confirm successful uploads. This structured approach ensures that the file can be assembled correctly in S3, mimicking a single upload. The article emphasizes the importance of choosing the right chunk size, considering factors like network speed and device performance.

This experience highlights the complexities of managing large file uploads and the benefits of adopting chunked upload strategies. As cloud storage and file sharing become increasingly integral to modern applications, understanding these techniques is crucial for developers aiming to provide a seamless user experience.