Hi David,
Thanks for your reply. Yes, I can upload new files and also updating an image is working using the admin panel. Please find my code below. In IF condition i am creating a new file in media library which is working fine and in ELSE condition i have to replace the file to existing media library file.
if (!File.Exists(Path.Combine(mediaDocsPath, libraryInfo.LibraryFolder, validDocsPath)))
{
MediaFileInfo mediaFile = new MediaFileInfo(path, libraryInfo.LibraryID);
mediaFile.FileTitle = "Document Title";
mediaFile.FileDescription = "Document Description";
//Replacing local docs path with empty to get path of file to be saved in media library
mediaFile.FilePath = docsPath.Replace(@"\", @"/");
MediaFileInfoProvider.SetMediaFileInfo(mediaFile);
}
else
{
MediaFileInfo updateMediaFile = MediaFileInfoProvider.GetMediaFileInfo(
libraryInfo.LibraryID,docsPath);
if (updateMediaFile != null)
{
MediaFileInfoProvider.SetMediaFileInfo(updateMediaFile);
}
}