debug uploadfile function