none
Folder Upload using Asp.net c# RRS feed

  • Question

  • 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


    • Edited by sandeepmsandy Thursday, January 23, 2020 9:48 AM
    • Moved by CoolDadTx Thursday, January 23, 2020 2:39 PM ASP.NET related
    Thursday, January 23, 2020 9:39 AM

All replies

  • Hello,

    The proper forum is here to ask this question. https://forums.asp.net/


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Thursday, January 23, 2020 11:24 AM