Sending file[type="file"] multiple content as list of base64's
while (files_obj.length &lt; files.length) {}


That's not the correct way to wait for the FileReader. onload will get called whenever a file has been successfully read, so you can check for files.length there, and call the rest of the function as needed. Right now you're spin-looping during at least partly CPU intensive (base64 encoding) operations. Which is a huge waste.