示例#1
0
        /// <summary>
        /// 上传背景
        /// </summary>
        /// <param name="proCode"></param>
        /// <returns></returns>
        public string UploadFile()
        {
            string fileUrl = "";

            try
            {
                string prefix   = OssFile.PrefixName;
                string fileName = prefix + OssFile.FormatName;
                string key      = OssFile.FilePath + fileName;
                PutObjectAPI.PutObjectFromStream(key, Content);
                fileUrl = FileUrlTool.GetFileUrl(key);
            }
            catch (Exception ex)
            {
                Log.Error("OssUploadHelper-UploadFile", ex.Message);
                fileUrl = "";
            }
            return(fileUrl);
        }
示例#2
0
        /// <summary>
        /// 上传背景
        /// </summary>
        /// <param name="proCode"></param>
        /// <returns></returns>
        public string UploadImg()
        {
            string imgUrl = "";

            try
            {
                string prefix      = Image.PrefixName;
                string imgFileName = FileUrlTool.GetFileUrl(prefix);
                string key         = Image.FilePath + imgFileName;
                PutObjectAPI.PutObjectFromStream(key, Content);
                imgUrl = FileUrlTool.GetFileUrl(key);
            }
            catch (Exception ex)
            {
                Log.Error("OssUploadHelper-UploadImg", ex.Message);
                imgUrl = "";
            }
            return(imgUrl);
        }