当前位置: 首页 > news >正文

衡阳网站定制google官方版下载

衡阳网站定制,google官方版下载,旧房改造室内装修设计公司,wordpress建站购买之前测试功能写过一次#xff0c;因为代码忘记保存#xff0c;导致真正用到的时候怎么也想不起来当初怎么写的了#xff0c;复现后还是写个文章记录一下#xff0c;省的下次再忘记。 php后端 /*** 图片保存到本地*/ public function uploadLocalImage() {try {$img $thi…之前测试功能写过一次因为代码忘记保存导致真正用到的时候怎么也想不起来当初怎么写的了复现后还是写个文章记录一下省的下次再忘记。 php后端 /*** 图片保存到本地*/ public function uploadLocalImage() {try {$img $this-_request-file(img);if (empty($img)) {throw new \Exception(缺少图片参数);}$writeDir images/.date(Ymd);$dir D:/phpstudy_pro/WWW/vkm_locarun_dist/dist/.$writeDir;//$dir local_run/ . date(Ymd); //linux调试地址if (!file_exists($dir)) {mkdir($dir, 0777, true);}$extension substr($img-getMimeType(), -3);if ($extension bmp) {$fileName UtilService::createOrderNo() . .bmp;}if ($extension png) {$fileName UtilService::createOrderNo() . .png;}else{$fileName UtilService::createOrderNo() . .jpg;}$imgContent file_get_contents($img);file_put_contents($dir . / . $fileName, $imgContent);$localhostImg env(CLIENT_URL) . $writeDir . / . $fileName;//http://127.0.0.1:8000/xxx/20231016/xxx.jpg 读取方式$this-returnSuccess($localhostImg);} catch (\Exception $e) {$this-returnFault($e-getMessage());} }Unity C# /// summary /// 上传文件到服务器 /// /summary /// param namefilePaths文件路径/param void UploadToLocalServer(string[] filePaths) {int count filePaths.Length;urls new string[count];isUploaded new bool[count];string filePath;//文件命为上传OSS时的keyfor (int i 0; i count; i){int current i;filePath filePaths[current];if (File.Exists(filePath)){File.SetAttributes(filePath, FileAttributes.Normal);StartCoroutine(UploadToLocal(filePath, current));}else{urls[current] none;}} } IEnumerator UploadToLocal(string filePath, int index) {byte[] fileByte File.ReadAllBytes(filePath);WWWForm form new WWWForm();//根据自己上传的文件修改格式,img是接口请求json参数的key, //最后一个参数是图片的mimeType, 因为上传的图片有jpg、png、bmp几种格式此处取文件后缀和image组合字符串作为mimeTypeform.AddBinaryData(img, fileByte, Path.GetFileName(filePath), $image/{Path.GetExtension(filePath)});Helper.Log(${Config.SystemConfig.sendHost}/uploadLocalImage);using (UnityWebRequest www UnityWebRequest.Post(${Config.SystemConfig.sendHost}/uploadLocalImage, form)){yield return www.SendWebRequest();if (www.result UnityWebRequest.Result.ConnectionError || www.result UnityWebRequest.Result.ProtocolError){urls[index] error;Helper.LogError($[ERROR] {filePath}, msg: {www.error});}else{string text www.downloadHandler.text;//Helper.Log(服务器返回值 text);JObject json JObject.Parse(text);if (json[msg].ToString().Equals(success)){urls[index] json[data].ToString();Helper.Log($[SUCCESS] {urls[index]});}else{urls[index] error;Helper.LogError($[ERROR] {filePath}, msg: {text});}isUploaded[index] true;}} }搞定。
http://www.eeditor.cn/news/125442/

相关文章:

  • 四川住房城乡建设厅网站电话wordpress 需要授权吗
  • 网站建设 软件开发的公司哪家好wordpress 分栏
  • 网络服务商官方网站项目营销推广方案
  • 企业网站建设方案服务微信群二维码推广平台
  • 一站式手机网站制作大学生创新创业大赛策划书
  • 专门学设计的网站wordpress 广告拦截插件
  • 怎么在网站标头做图标网站设计导航栏高度
  • 建行网上银行登录入口官网seo排名优化方式
  • 网站seo优化的重要性百度网站收录更新
  • 为何网站建设公司报价不同WordPress京东淘宝主题
  • 郑州做网站公司yooker重庆是哪个省划分出来的
  • php做的直播网站电视直播网站开发
  • 专做定制的网站wordpress首页自定义小工具
  • 舆情分析报告舟山网站建设优化
  • 做服务网站要多少钱app推广营销公司
  • 青岛教育平台网站建设建设工程信息网官网重庆
  • 电子商务网站建设移动电商开发围上如何做快递查单网站
  • 网站平台构建网页设计实训总结报告3000字
  • 深圳做网站推荐哪家公司好不动产登记门户网站建设方案
  • 企业网站能自己建设吗做网站大概要多少钱
  • 做网站图标的软件网站开发的方式
  • 自建个人网站四川广汇建设有限公司网站
  • 网站倒计时代码在国外做网站推广
  • 网站制作关键词seo一个关键词多少钱
  • 合肥网站建怎样推广海外网站
  • 聊城网站案例中企动力工作两个月感受
  • 响水建设局网站软件开发定制app
  • 环保局 网站建设网站开发与设计实验报告
  • 用nas做网站贵州最新消息今天
  • 平湖网站开发关镇铨装修到底怎样