Better handling of existing files. Added 'onopen' event handler. Uploads object is passed more often in events. Refactored upload script