public int UploadFile(string srcUrl, string destUrl)
{
if (!System.IO.File.Exists(srcUrl))
{
throw new ArgumentException(String.Format("{0} does not exist",
srcUrl), “srcUrl”);
}
SPWeb site = new Microsoft.SharePoint.SPSite(destUrl).OpenWeb();
System.IO.FileStream fStream = System.IO.File.OpenRead(srcUrl);
byte[] contents = new byte[fStream.Length];
fStream.Read(contents, 0, (int)fStream.Length);
fStream.Close();
//EnsureParentFolder(site, destUrl);
try
{
site.Files.Add(destUrl, contents);
return 1;
}
catch (Exception ex)
{
return 0;
}
}
// its not saving the file in the share point site :
hkhkgweb01/…/Estimate Sheet.xlsx
//The error specifying dest site cant be found.