码迷,mamicode.com
首页 > 其他好文 > 详细

Sitecore操作Media上传图片

时间:2014-08-11 14:30:22      阅读:232      评论:0      收藏:0      [点我收藏+]

标签:des   blog   os   io   ar   div   amp   new   

            try
            {
                Sitecore.Resources.Media.MediaCreatorOptions options = new Sitecore.Resources.Media.MediaCreatorOptions();
                options.Database = Sitecore.Configuration.Factory.GetDatabase("master");
                options.Language = Sitecore.Globalization.Language.Parse(Sitecore.Configuration.Settings.DefaultLanguage);
                options.Versioned = Sitecore.Configuration.Settings.Media.UploadAsVersionableByDefault;
                options.Destination = "/sitecore/media library/Pampers/Images/Expert/doctor1";
                options.FileBased = Sitecore.Configuration.Settings.Media.UploadAsFiles;
                string filePath = "E:\\doctor1.png";
                Sitecore.Data.Items.MediaItem sampleMedia = MediaManager.Creator.CreateFromFile(filePath, options);

                this.divError.InnerText = sampleMedia.ID.ToString();
            }
            catch (Exception ex)
            {
                this.divError.InnerText = ex.Message;
            }

  

Sitecore操作Media上传图片,布布扣,bubuko.com

Sitecore操作Media上传图片

标签:des   blog   os   io   ar   div   amp   new   

原文地址:http://www.cnblogs.com/nandou/p/3904339.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!