Ejemplo n.º 1
0
        public void UploadFile2()
        {
            //获取文件值
            string filename = Request.QueryString["value"];

            //获取图片
            string oldfilename = "wechat.png";
            var    contentType = MimeMapping.GetMimeMapping(oldfilename);
            var    bytes       = mongoDBHelper.DownloadAsBytesByName(oldfilename);

            //通过Metadata 添加附加信息
            GridFSUploadOptions option = new GridFSUploadOptions();

            option.ContentType = contentType;
            mongoDBHelper.UploadFromBytes(bytes, filename, option);

            ViewImg();
        }