读取数据库二进制视频并返回路径

 var virpath1 = "/upload/video/";
                string dirFullPath1 = Server.MapPath(virpath1);
                var video = VideoHelper.GetProductVideoUrl(dirFullPath1, virpath1, model.video, videoName);


public static string GetProductVideoUrl(string dirFullPath, string virpath, byte[] model, string qrCode)
        {
            if (model == null)
            {
                return "";
            }
            else
            {
                if (!Directory.Exists(dirFullPath))//如果文件夹不存在,则先创建文件夹
                {
                    Directory.CreateDirectory(dirFullPath);
                }
                var fileName = qrCode;
                dirFullPath = dirFullPath + fileName;
                if (!File.Exists(dirFullPath))
                {
                    SaveToVideo(dirFullPath, model);
                }
                var url = WebConfigurationManager.AppSettings["hostUrl"].ToString();
                return url + virpath + fileName;
            }
        }

        private static void SaveToVideo(string path, byte[] bytes)
        {
            FileStream fs = new FileStream(path, FileMode.CreateNew);
            fs.Write(bytes, 0, bytes.Length);
            fs.Close();
        }

 

读取数据库二进制视频并返回路径

上一篇:vue项目配置 `webpack-obfuscator` 进行代码加密混淆


下一篇:Chrome Console 编程小技巧之 03 console.error显示错误