I have a Provider Hosted App, one of it's functionality is to upload the images into sharepoint picture library.
I am able to store the picture into some folder, using the below code.
public ActionResult Upload(HttpPostedFileBase file)
{
var hostweb = HttpContext.Request["SPHostUrl"];
Helper.WriteLog(hostweb);
Uri hosturi = new Uri(hostweb);
using (var clientContext = new ClientContext(hosturi))
{
//List Photos = clientContext.Web.Lists.GetByTitle("Photos");
var fileinfo = new FileCreationInformation();
fileinfo.Content = Helper.ReadFully(file.InputStream);
//This will convert the Input Stream to byte[]
var fileName = Path.GetFileName(file.FileName);
var path = Path.Combine("E:/Photos", fileName);
file.SaveAs(path);
Helper.WriteLog(path);
}
return View();
}
Now I want to store the Image to the Photos Library. How should I do it.