Changed function to upload file to server