Exemplo n.º 1
0
        public ActionResult UploadFile(FineUpload upload, string id)
        {
            // asp.net mvc will set extraParam1 and extraParam2 from the params object passed by Fine-Uploader
            //  return View();

            var dir      = Server.MapPath("~/UploadPictures/");
            var filePath = Path.Combine(dir, upload.Filename);

            try
            {
                upload.SaveAs(filePath);
            }
            catch (Exception ex)
            {
                return(new FineUploaderResult(false, error: ex.Message));
            }

            //// the anonymous object in the result below will be convert to json and set back to the browser
            return(new FineUploaderResult(true, new { extraInformation = 12345 }));
        }
Exemplo n.º 2
0
        public ActionResult UploadFile(FineUpload upload, int?id)
        {
            // asp.net mvc will set extraParam1 and extraParam2 from the params object passed by Fine-Uploader
            //  return View();
            PACKAGING pr = db.PACKAGINGs.Where(x => x.ID_PACKAGING == id).First();

            var dir      = Server.MapPath("~/UploadPictures/");
            var filePath = Path.Combine(dir, upload.Filename);

            pr.IMAGE           = "../../UploadPictures/" + upload.Filename;
            db.Entry(pr).State = EntityState.Modified;
            db.SaveChanges();
            try
            {
                upload.SaveAs(filePath);
            }
            catch (Exception ex)
            {
                return(new FineUploaderResult(false, error: ex.Message));
            }

            //// the anonymous object in the result below will be convert to json and set back to the browser
            return(new FineUploaderResult(true, new { extraInformation = pr.IMAGE }));
        }