I had a function working to upload some data to a server. The php file received it and wrote it to a text file just fine. I changed something I suppose, because it does not work anymore and I cannot figure why. I’ve re-written it to make it as simple as can be, both on the Unity and PHP side without luck. I’d be very appreciative if someone could tell me what I’m doing incorrectly. I can get to the php file, and get the echo back from it. But the form fields I send to it seem to come through as null. I’ve used breakpoints to confirm that the form data are being populated correctly on Unity’s side.
public IEnumerator do_upload(string filename, string datastring, string URL)
{
UnityWebRequest webRequest;
List<IMultipartFormSection> form_data = new List<IMultipartFormSection>();
form_data.Add(new MultipartFormDataSection("Filename", filename));
form_data.Add(new MultipartFormDataSection("Data", datastring));
webRequest = UnityWebRequest.Post(URL, form_data);
yield return webRequest.SendWebRequest();
messages.text = webRequest.downloadHandler.text;
}
I have tried this with both a WWWForm and the MultipartFormSection list. In both cases my PHP file does not receive the fields Filename and Data. messages.text shows "Php run. Filename = datastring = "
<?php
$Filename = $_POST["Filename"];
$DataString = $_POST["Data"];
echo("Php run. Filename = ".$Filename . " datastring = " . $DataString);
?>
$Filename and