Reputation: 6565
I have a simple script to upload a file. Actually everything is working fine.
private void UploadCSV()
{
Uri address = new Uri("https://www.mydomain.xy/inc.upload.php");
string fileName = @"C:\test.csv";
using (WebClient client = new WebClient())
{
var parameters = new NameValueCollection();
parameters.Add("test", "aaaa");
client.QueryString = parameters;
client.UploadProgressChanged += WebClientUploadProgressChanged;
client.UploadFileCompleted += WebClientUploadCompleted;
client.UploadFileAsync(address, "POST", fileName);
}
}
Now as you can see, I try so send some data via POST test
what contains aaaa
. But now matter how I try to select the data serverside... there is nothing....
I tried $_POST['test'], $_POST['data']['test']
.... but no results.
How can I access the extra Data ?
Upvotes: 0
Views: 49
Reputation: 96306
client.QueryString = parameters;
This will append a query string to the URL that you send the data to.
Even though the request method is POST, PHP always provides the query string parameters in $_GET
.
Upvotes: 2