Good afternoon,
I need to make a windows application that upload files (jpg) that are on my computer to a web hosting.
Have tried various codes that I saw on the net but none worked.
Does anyone have a code that works that I intend to do this? May be in VB.NET or C#
Paulo
Raghvendr SinghPosted Jan 21, 2011, 12:32 AM
There are several way to upload files.For window application try this one.
add nemespace
using System.Net;
private void btnUpload_Click(object sender, EventArgs e)
{
string fName;
string fNameToSave="file1.jpg";
openFileDialog1 = new OpenFileDialog();
openFileDialog1.ShowDialog();
fName = openFileDialog1.FileName;
uploadFile(ftp://xxx.xxx.xxx.xxx, "userid", "password", fName, fNameToSave);
}
public void uploadFile(string ftpAdd, string userName, string pass, string fName1, string fNameToSave1)
{
WebClient wc = new WebClient();
wc.Credentials = new System.Net.NetworkCredential(userName, pass, "sgs-infotech.com");
wc.UploadFile(ftpAdd +"/"+ fNameToSave1, "STOR", fName1);
}