Ejemplo n.º 1
0
        //public JsonRequestBehavior GetStateByStateID(short stateId)
        //{
        //    var states = _stateRepository.Get(w => w.cod_estado == stateId).cod_estado;
        //    return Json(new { Result = true, states = states }, JsonRequestBehavior.AllowGet);
        //}
        //
        // GET: /FileUpload/
        public FineUploader.FineUploaderResult UploadFile(FineUploader.FineUpload upload)
        {
            // asp.net mvc will set extraParam1 and extraParam2 from the params object passed by Fine-Uploader
            var dir = ConfigurationManager.AppSettings.Get("ImageUpload");

            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 { fileName = upload.Filename });
        }