Stop Uploading User Photos to Your Server: Hit Exact File-Size Limits in the Browser

javascript dev.to

Every developer has met this form validation message: "Photo must be under 200KB." "Signature: max 50KB." The usual fix is to send the user's photo to the server, resize it there, and send it back. It works — but it also means a stranger's ID photo, signature, or profile picture just travelled to your infrastructure and sat in a temp folder so you could shrink it. There is a better default: do the whole job in the browser. The file never leaves the device, and you still hit the exact size limit

Read Full Tutorial open_in_new
arrow_back Back to Tutorials