返回首页

unity传图片php

100 2024-02-27 19:21 admin
csharp void UploadImage(Texture2D texture) { byte[] imageBytes = texture.EncodeToPNG(); string url = "upload.php"; WWWForm form = new WWWForm(); form.AddField("image", Convert.ToBase64String(imageBytes)); UnityWebRequest www = UnityWebRequest.Post(url, form); yield return www.SendWebRequest(); if (www.isNetworkError || www.isHttpError) { Debug.Log("Error uploading image: " + www.error); } else { Debug.Log("Image uploaded successfully!"); } }
顶一下
(0)
0%
踩一下
(0)
0%
相关评论
我要评论
用户名: 验证码:点击我更换图片

网站地图 (共30个专题71917篇文章)

返回首页