Exemple #1
0
 public static IHttpPostedFile From(HttpPostedFileVO vo)
 {
     if (vo == null || vo.Content == null || vo.Content.Length == 0)
         return null;
     var wrapper = new HttpPostedFileWrapper();
     wrapper.FileName = vo.FileName;
     wrapper.ContentType = vo.ContentType;
     wrapper.ContentLength = vo.Content.Length;
     wrapper.InputStream = new MemoryStream(vo.Content);
     return wrapper;
 }
Exemple #2
0
        public static HttpPostedFileVO ToVO(IHttpPostedFile file)
        {
            if (file == null || file.ContentLength == 0)
                return null;

            var vo = new HttpPostedFileVO();
            vo.FileName = file.FileName;
            vo.ContentType = file.ContentType;
            vo.Content = new byte[file.InputStream.Length];
            file.InputStream.Read(vo.Content, 0, vo.Content.Length);
            return vo;
        }
Exemple #3
0
        public static IHttpPostedFile From(HttpPostedFileVO vo)
        {
            if (vo == null || vo.Content == null || vo.Content.Length == 0)
            {
                return(null);
            }
            var wrapper = new HttpPostedFileWrapper();

            wrapper.FileName      = vo.FileName;
            wrapper.ContentType   = vo.ContentType;
            wrapper.ContentLength = vo.Content.Length;
            wrapper.InputStream   = new MemoryStream(vo.Content);
            return(wrapper);
        }
Exemple #4
0
        public static HttpPostedFileVO ToVO(IHttpPostedFile file)
        {
            if (file == null || file.ContentLength == 0)
            {
                return(null);
            }

            var vo = new HttpPostedFileVO();

            vo.FileName    = file.FileName;
            vo.ContentType = file.ContentType;
            vo.Content     = new byte[file.InputStream.Length];
            file.InputStream.Read(vo.Content, 0, vo.Content.Length);
            return(vo);
        }