Folder Upload using Asp.net c#

  • Thread starter Thread starter sandeepmsandy
  • Start date Start date
S

sandeepmsandy

Guest
Hi,


i have a query on folder upload control using ajax cute UI using asp.net c#.Please suggest me solution

iam able to upload the folder in to a directory inside the project, but not able upload multiple files in folder and refresh second time before inserting clear contents from folder add newly updated multiple files.

Please check for below Code Snippet


void Attachments1_FileUploaded(object sender, UploaderEventArgs args)
{

var FolderName = txtFontfamily.Text;
string FontPath = Server.MapPath("Fonts") + "\\" + FolderName;
if (System.IO.Directory.Exists(FontPath))
{
//Delete all files from the Directory
foreach (string file in System.IO.Directory.GetFiles(FontPath))
{
System.IO.File.Delete(file);
}

//Delete a Directory
//System.IO.Directory.Delete(FontPath);
}
bool exists = System.IO.Directory.Exists(FontPath);
if (!exists)
System.IO.Directory.CreateDirectory(FontPath);

args.CopyTo(FontPath + "\\" + args.FileName);


}
With Regards,

Sandeep M

Continue reading...
 
Back
Top