Yes, you are correct, thanks a lot for the help Joerg.
I am able to do what you said with the following:
HttpWebRequest req = (HttpWebRequest)
WebRequest.Create("http://www.mysite.com/index.php");
string boundary =
Guid.NewGuid().ToString().Replace("-",
"");
req.ContentType = "multipart/form-data; boundary=" +
boundary;
req.Method = "POST";
MemoryStream postData = new MemoryStream();
string newLine = "\r\n";
StreamWriter sw = new StreamWriter(postData);
sw.Write("--" + boundary + newLine);
sw.Write("Content-Disposition: form-data;
name=\"{0}\";
filename=\"{1}\"{2}",
"upload", "test.jpg", newLine);
sw.Write("Content-Type: image/pjpeg " + newLine +
newLine);
sw.Flush();
postData.Write(contents, 0, contents.Length);
sw.Write(newLine);
sw.Write("--{0}--{1}", boundary,
newLine);
sw.Flush();
req.ContentLength = postData.Length;
using (Stream s = req.GetRequestStream())
postData.WriteTo(s);
postData.Close();
contents being a byte array of the file.
And this is successful. However, I need to be able to send that, as
well as normal POST data as my previous code example was doing.
However, I cannot figure out how to combine the two.
Any help?
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com