Your script will call checkUpload() with a timer without going through the expected id parameter.
Line 30
window.setTimeout('checkUpload();', 333);
Change to
window.setTimeout( function(){ checkUpload(id); }, 333 );
In the future, as a useful tip, I recommend that you publish your current issue for the first time, and not an example that, in your opinion, illustrates the issue. It just saves time and effort;)
source share