المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Upload file using webclient



C# Programming
03-05-2013, 10:11 AM
Hi,

I am trying to upload a file from my laptop to remote development server. It keeps coming back with either 404 error or 405 error. I am able to download a file with no issues at at all.

all I have is a form with a button on it, and clicking on button invokes the below.

I get the message, "Upload Complete" but the file does not exist on the remote server.

private void button3_Click(object sender, EventArgs e) { WebClient wcUpload = new WebClient(); NetworkCredential myNwc = new NetworkCredential("username", "password"); wcUpload.Credentials = myNwc; wcUpload.UploadFile("http://:85", "POST", "C:\\projects\\ProgressBar\\file_0122.csv"); MessageBox.Show("Upload complete!!"); }// end button3_Click