This is what I started, but I couldn't seem to get anything to happen...
EDIT: Bear in mind I've completely winged this. Truthfully I just don't have a clue and this was more of a guess/codejacking. My plan, Mark, actually was to send a byte array to a php script that acted as a web service. Unfortunately, I've never dealt with file transfers and as such, I don't even know how to do that! lol I'm at ground zero.
string localFile;
string uploadUrl;
- try
-
{
-
-
FileStream rdr = new FileStream(localFile, FileMode.Open);
-
byte[] inData = new byte[4096];
-
int totbytes = 0;
-
MemoryStream postData = new MemoryStream();
-
int bytesRead = rdr.Read(inData, 0, inData.Length);
-
while (bytesRead > 0)
-
{
-
postData.Write(inData, 0, bytesRead);
-
bytesRead = rdr.Read(inData, 0, inData.Length);
-
totbytes += bytesRead;
-
}
-
rdr.Close();
-
postData.Position = 0;
-
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(uploadUrl);
-
req.Method = "POST";
-
req.ContentLength = (long)postData.Length;
-
using (Stream s = req.GetRequestStream())
-
{
-
s.Write(postData.ToArray(), 0, (int)postData.Length);
-
postData.Close();
-
}
-
WebResponse resp = req.GetResponse();
-
resp.Close();
-
}
-
catch (Exception ex)
-
{
-
}
-
finally
-
{
-
}