Esempio n. 1
0
        public ActionResult LoadFile(int id)
        {
            string extension = null;

            using (Conector.Comon common = new Conector.Comon())
            {
                extension = common.GetExtension(id);
            }
            return(File(global::System.IO.File.ReadAllBytes(Path.Combine(PathContent, id.ToString())), extension));
        }
Esempio n. 2
0
        public JsonResult SaveFile()
        {
            HttpPostedFileBase file = Request.Files[0];
            int FileId;

            using (Conector.Comon common = new Conector.Comon())
            {
                FileId = common.SaveFile(Path.GetExtension(file.FileName));

                MemoryStream target = new MemoryStream();
                file.InputStream.CopyTo(target);
                byte[] data = target.ToArray();

                global::System.IO.File.WriteAllBytes(Path.Combine(PathContent, FileId.ToString()), data);
            }
            return(Json(new SaveFileResponse()
            {
                Id = FileId
            }));
        }