I want to upload multiple files using single upload button. When I select more than one files it uploads and leaves rest of the files. Here is my code:
private void buttonBrowse_Click(object sender, EventArgs e)
{
try
{
var o = new OpenFileDialog();
o.Multiselect = true;
if (o.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string FileName = o.FileName;
string filenames = Path.GetFileName(o.FileName);
FileName = FileName.Replace(filenames,"").ToString();
FTPUtility obj = new FTPUtility();
if (obj.UploadDocsToFTP(FileName, filenames))
{
MessageBox.Show("File Uploaded Successfully...", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
loadfiles();
}
}
else
{
MessageBox.Show("File Not Uploaded", "Error Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
this.LoadFiles();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}