/// <summary> /// 上传文件 /// </summary> public static IEnumerator UploadFile(string varPath) { WWWForm tempForm = new WWWForm(); string[] tempSp = varPath.Split('/'); tempForm.AddField("Directory", "PineappleAR/"); tempForm.AddBinaryData("FileUpload", ReadFile.ReadFileStream(varPath), tempSp[tempSp.Length - 1]); WWW tempWWW = new WWW("http://39.108.137.135/Upload/ReceiveFiles.php", tempForm); yield return(tempWWW); Debug.Log(tempWWW.text); }
/// <summary> /// 根据图片路径返回图片的字节流 /// </summary> public byte[] GetImageByte(string varPath) { return(ReadFile.ReadFileStream(varPath)); }