23/resumable.js — pull request #96 by tpodom (2013-08-18 11:15:30+00:00)
Title: Modified check for fileSuccess to base it off of status instead

File progress returns the number of bytes sent to the server. However, just because the bytes have been sent doesn't mean that the server has received all of the bytes and returned a response. We key off of the fileSuccess event to fire off a separate request to commit the chunks and when the fileSuccess fires too early we attempt to build the complete file before the last chunk(s) are finished uploading.

I was able to pretty easily reproduce this by modifying my server to delay the response to the chunk upload by 1s*chunk # to force the chunks to stagger. Then with an 8 chunk file the last chunk would finish sending and the fileSuccess would fire when the 7th chunk completed.