Basically, I encode my texture into byte[ ] using Encode.PNG and I am able to upload a file to the website as JSON, the size of the pictures is 19KB. However, when I tried uploading pictures around 900KB, it showed HTTP 400 bad request. The question here is: does the web request post have a file size limit, or the problem is on the server site. Since the server side is not written by me so I want to know if the problem is with the function. Thanks
IEnumerator UploadImage()
{
WWWForm form = new WWWForm();
form.AddField("user_id", "_Pictures");
form.AddField("data", ImageData);
using (UnityWebRequest www = UnityWebRequest.Post("Example.com", form))
{
www.timeout = 100;
Debug.Log(www.uploadProgress);
yield return www.SendWebRequest();
if (www.result != UnityWebRequest.Result.Success)
{
Show_status.text = "Upload failed, please check your internet connection";
Debug.Log(www.error);
}
else
{
Show_status.text = "Image upload complete";
Debug.Log("Image upload complete!");
}
}
}