function for uploading file