C csharpula csharp Nov 11, 2008 #1 Hello, I am trying to transfer zip file via http - how can I do it in c#? Thank you!
A Anthony Jones Nov 11, 2008 #2 csharpula csharp said: Hello, I am trying to transfer zip file via http - how can I do it in c#? Click to expand... Tranfer from a client to a web server? var client = new System.Net.WebClient(); client.UploadFile(sUrl, sFilePath); Note this uses a POST so the web server would need a script on the other end to recieve and process the file. More specific instructions require more specific description of the job.
csharpula csharp said: Hello, I am trying to transfer zip file via http - how can I do it in c#? Click to expand... Tranfer from a client to a web server? var client = new System.Net.WebClient(); client.UploadFile(sUrl, sFilePath); Note this uses a POST so the web server would need a script on the other end to recieve and process the file. More specific instructions require more specific description of the job.
C csharpula csharp Nov 11, 2008 #3 What is the difference between : WebClient client = new WebClient(); client.UploadFile(url,path); And the option of using: HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(httpPath); for the purpose of uploading zip file to some http location? Thank you!
What is the difference between : WebClient client = new WebClient(); client.UploadFile(url,path); And the option of using: HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(httpPath); for the purpose of uploading zip file to some http location? Thank you!
J Jesse Houwing Nov 11, 2008 #4 Hello csharpula, What is the difference between : WebClient client = new WebClient(); client.UploadFile(url,path); And the option of using: HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(httpPath); for the purpose of uploading zip file to some http location? Click to expand... The second option is used to *download*, not upload a file from that location.
Hello csharpula, What is the difference between : WebClient client = new WebClient(); client.UploadFile(url,path); And the option of using: HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(httpPath); for the purpose of uploading zip file to some http location? Click to expand... The second option is used to *download*, not upload a file from that location.
A Arne Vajhøj Nov 11, 2008 #5 Jesse said: The second option is used to *download*, not upload a file from that location. Click to expand... Not necessarily. (Http)WebRequest is perfectly capable of sending a POST request that uploads data. Arne
Jesse said: The second option is used to *download*, not upload a file from that location. Click to expand... Not necessarily. (Http)WebRequest is perfectly capable of sending a POST request that uploads data. Arne
A Arne Vajhøj Nov 11, 2008 #6 csharpula said: What is the difference between : WebClient client = new WebClient(); client.UploadFile(url,path); And the option of using: HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(httpPath); for the purpose of uploading zip file to some http location? Click to expand... WebClient is a very high level class that provides some convenience methods. (Http)WebRequest is a more low level class (but still way above TcpClient) that gives you access to headers and streams. Arne
csharpula said: What is the difference between : WebClient client = new WebClient(); client.UploadFile(url,path); And the option of using: HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(httpPath); for the purpose of uploading zip file to some http location? Click to expand... WebClient is a very high level class that provides some convenience methods. (Http)WebRequest is a more low level class (but still way above TcpClient) that gives you access to headers and streams. Arne