fix file upload function for server