I need to upload a file to my webserver from a C# program. The problem is, I need to also POST two strings at the same time. So far, I have:
            HttpWebRequest HttpWReq = (HttpWebRequest)WebRequest.Create("http://localhost/test.php");             
            ASCIIEncoding encoding = new ASCIIEncoding();
            string postData = "&name=Test";
            postData += "&email=a@a.com";
            postData += "&file=file.txt";
            byte[] data = encoding.GetBytes(postData);
            HttpWReq.Method = "POST";    
            HttpWReq.ContentType = "application/x-www-form-urlencoded";   
            HttpWReq.ContentLength = data.Length;    
            Stream newStream = HttpWReq.GetRequestStream();
            newStream.Write(data, 0, data.Length);
            newStream.Close();
Here's the HTML and PHP:
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$target_path = "uploads/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
echo (move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path) ? "Success!" : "Failed");
?>
<form enctype="multipart/form-data" action="test.php" method="POST">
Name : <input type="text" name="name"><br />
Email : <input type="text" name="email"><br />
File : <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Being Upload" />
</form>
I don't know where to add the file field though :\ Any help would be appreciated!
 
    