Esempio n. 1
0
        public async Task <JsonResult> FileUploader(IList <IFormFile> files, string destination, bool isCrop, string allowExt = "")
        {
            if (string.IsNullOrEmpty(destination))
            {
                return(Json(new FileUploadResponse()
                {
                    messages = new List <string>()
                    {
                        "Error"
                    }
                }));
            }
            string basePath = FileUploadHelper.DecryptString(destination);

            //else
            //{
            //    basePath = Path.Combine(CurrentHostEnvironment.WebRootPath, "upload");
            //}
            if (!string.IsNullOrEmpty(allowExt))
            {
                allowExt = FileUploadHelper.DecryptString(allowExt);
            }
            var result = new FileUploadHelper().FileUpload(files, basePath, isCrop, allowExt);

            return(Json(result));
        }