So, you\u2019re filling out an online form, and it asks you to upload a file. You click the input, select a file from your desktop, and are good to go. But something happens. The network drops, the file disappears, and you\u2019re stuck having to re-upload the file. Poor network connectivity<\/strong> can lead you to spend an unreasonable amount of time trying to upload files successfully.<\/p>\n
What ruins the user experience stems from having to constantly check network stability and retry the upload several times. While we may not be able to do much about network connectivity, as developers, we can always do something to ease the pain that comes with this problem.<\/p>\n
One of the ways we can solve this problem is by tweaking image upload systems in a way that enables users to upload images offline — eliminating the need for a reliable network connection<\/strong>, and then having the system retry the upload process when the network becomes stable, without the user intervening.<\/p>\n
This article is going to focus on explaining how to build an offline-friendly image upload system<\/strong> using PWA (progressive web application) technologies such as IndexedDB<\/code>, service workers, and the Background Sync API. We will also briefly cover tips for improving the user experience for this system.<\/p>\n
Planning The Offline Image Upload System<\/h2>\n
Here\u2019s a flow chart for an offline-friendly image upload system.<\/p>\n<\/p>\n