Reputation: 1447
I have a javascript file that sends a FormData variable to another site as follows:
xhr.open("post", "http://host/path/file.php", true);
xhr.send(data);
The data variable is correctly populated I have verified that this is not the issue as the payload on my Network tab reads the correct values, the request header has a content-length > 0 :
Accept:*/*
Accept-Encoding:gzip,deflate
Accept-Language:en-GB,en-US;q=0.8,en;q=0.6
Connection:keep-alive
Content-Length:6021726
Content-Type:multipart/form-data; boundary=----WebKitFormBoundaryAj8A2cYqFIFtNwHI
Host:host
Origin:http://host
Referer:http://host/path
User-Agent:Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36
However the response header content-length=0:
Access-Control-Allow-Origin:*
Content-Length:0
Content-Type:text/html; charset=UTF-8
Date:Thu, 02 Oct 2014 19:34:49 GMT
Server:Microsoft-IIS/8.5
X-Powered-By:PHP/5.6.0
X-Powered-By:ASP.NET
Any help would be greatly appreciated, I read there is an issue with IE and Windows Authentication that causes this but I am using Chrome and Firefox. For both sites I have allowed both Anonymous and Windows Authentication (they are both IIS sites). Any help would be greatly appreciated.
Upvotes: 2
Views: 390
Reputation: 1447
Well it was pointless posting my problem here as no one helped, in the case the some else has this issue I will post what fixed my issue. It seems when you send an XMLHttpRequest of type multipart/form-data that string data can be found in the $_POST variable but any file data is located in the $_FILES variable.
Also I was confused in what the browser was telling me, it wasn't necessarily that data wasn't being sent but the Content-Length of my response header was empty until I actually printed the POST/FILES variables then it was showing a length > 0. I was stuck on that for a while so I thought I would also add it to my solution.
Upvotes: 1