Click here to Skip to main content
15,947,411 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to upload entire folder using C#..
Please help me..
Updated 5-Aug-22 1:40am

DirectoryInfo d = new DirectoryInfo(Server.MapPath("~/Upload"));
        foreach (FileInfo f in d.GetFiles("*.jpg")) {
                byte[] buffer = new byte[f.OpenRead().Length];
                f.OpenRead().Read(buffer, 0, (int)f.OpenRead().Length);
                PhotoManager.AddPhoto(Convert.ToInt32(Request.QueryString["AlbumID"]), f.Name, buffer);
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900