finish the file upload function.