예제 #1
0
        public async Task <ActionResult> Upload(string Name, HttpPostedFileBase Parvandeh)
        {
            try
            {
                var _Bytes = new byte[Parvandeh.ContentLength];
                Parvandeh.InputStream.Read(_Bytes, 0, Parvandeh.ContentLength);

                dc.File_Insert(null, Name, _Bytes, Parvandeh.ContentType);
                return(RedirectToAction("Index"));
            }
            catch
            {
                ViewBag.Message = "خطا در بارگزاری فایل";
                if (Request.IsAjaxRequest())
                {
                    return(PartialView());
                }
                return(View());
            }
        }
예제 #2
0
        public async Task <ActionResult> Upload(string Name, HttpPostedFileBase Parvandeh)
        {
            try
            {
                var _Bytes = new byte[Parvandeh.ContentLength];
                Parvandeh.InputStream.Read(_Bytes, 0, Parvandeh.ContentLength);

                dc.File_Insert(Name, _Bytes, Parvandeh.ContentType, Session["Username"].ToString());
                return(RedirectToAction("Index"));
            }
            catch
            {
                ViewBag.Message = "Upload failure";
                if (Request.IsAjaxRequest())
                {
                    return(PartialView());
                }
                return(View());
            }
        }
예제 #3
0
 public bool Insert(string Name, string Type, byte[] File)
 {
     dc.File_Insert(null, Name, Type, File);
     return(true);
 }