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%
- 相关评论
- 我要评论
-