try {
SPSecurity.RunWithElevatedPrivileges(delegate() { oFile = @"filepath"; byte[] binFile = oFile.OpenBinary(); string path = @"D:\Library\"; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string tepmPath = path + oFile.Name; if (File.Exists(tepmPath)) { File.Delete(tepmPath); } using (FileStream fs = File.Create(tepmPath)) { fs.Write(binFile, 0, binFile.Length); fs.Close(); } }); }
catch (Exception ex)
{
//exception handleing here
}
Showing posts with label file. Show all posts
Showing posts with label file. Show all posts
Saturday, 25 April 2015
Save file in local drive
Labels:
file,
library,
local drive,
save in directory

Subscribe to:
Posts (Atom)