I\'m trying to upload a file and a send along a few parameters to my site using .NET / C#. Having read a few tutorials that do either a few parameters or a file, I\'ve tried
The problem is that you're missing a '\n'. The following line:
string postData = "--" + boundary + "\nContent-Disposition: form-data\n";
should be:
string postData = "--" + boundary + "\nContent-Disposition: form-data\n\n";
And this line:
postData += "\n--" + boundary + "\nContent-Disposition: form-data; name=\"file\" filename=\"upload.pdf\" Content-Type: application/pdf\n\n"
is missing a '\n' before 'Content-Type'. It should be:
postData += "\n--" + boundary + "\nContent-Disposition: form-data; name=\"file\" filename=\"upload.pdf\"\nContent-Type: application/pdf\n\n"