Working example of upload with JavaScript