The best option is to run the uploads synchronously. So that two photos couldn't be uploaded at the exact same time. Which can be done by changing your JavaScript to
Code JavaScript:
xhr.open("POST", $id("upload").action, false);