Read any file using filepath and save it in a folder in c#

//Read file to byte array

FileStream stream = File.OpenRead(@"c:\path\to\your\file\here.txt");
byte[] fileBytes= new byte[stream.Length];

stream.Read(fileBytes, 0, fileBytes.Length);
stream.Close();
//Begins the process of writing the byte array back to a file

using (Stream file = File.OpenWrite(@"c:\path\to\your\file\here.txt"))
{
   file.Write(fileBytes, 0, fileBytes.Length);
}

Comments

Popular posts from this blog

How to use youtube api's in your application.

Implement virtualisation in kendo drop down list using jquery ajax in mvc, aspx page

Interview Questions-2