Ramco Ramco

Ramco Ramco

  • 437
  • 3.4k
  • 542.8k

Save File in Application folder

Dec 27 2022 3:29 PM

Hi

  I want to save file in Application folder not in D:. How it can be done

var pdf0 = DateTime.Now.ToString("yyyyMMddHHmm") + "_" +secondPart;
            var request0 = new RestRequest(@"/" + secondPart, Method.GET);
            var client0 = new RestClient(firstPart);
            var content = client0.DownloadData(request0);

            MemoryStream ms = new MemoryStream(content);
            FileStream file = new FileStream(@"D:\" + pdf0 , FileMode.Create, FileAccess.Write);
            ms.WriteTo(file);
            file.Close();

Thanks


Answers (7)