//读取本地文件
//获取文件对象(path为文件路径)
FileInfo fileInfo = new FileInfo(path);
//获取长度
double length = (int)Convert.ToDouble(fileInfo.Length);
//获取文件名
string name = path.Substring(path.LastIndexOf("\\") + 1);
//将文件转换为流
FileStream openFile = new FileStream(path, FileMode.Open, FileAccess.Read);
//定义二进制数组对象
byte[] newFile = new byte[Size];
//读取文件流到二进制数组
openFile.Read(newFile, 0, newFile.Length);
openFile.Close();
openFile.Dispose();
//添加表单
//创建表单
WWWForm form = new WWWForm();
form.AddField("operId", Globle.id);
form.AddField("passWord", Globle.password);
//添加文件(输入对象的名字、二进制数组、文件名)
form.AddBinaryData("file", newFile,name);
UnityWebRequest webRequest = UnityWebRequest.Post(FunUrl.SendLog, form);
yield return webRequest.SendWebRequest();