public async Task <IActionResult> Upload( //List<IFormFile> files bool?resizeImages, int?maxWidth, int?maxHeight, string currentDir = "", string croppedFileName = "" ) { var theFiles = HttpContext.Request.Form.Files; var imageList = new List <UploadResult>(); if (resizeImages.HasValue) { if (resizeImages.Value == false) { if (Path.HasExtension(currentDir)) //this will be true for cropped { currentDir = currentDir.Substring(0, currentDir.LastIndexOf("/")); } } } string newFileName = string.Empty;; if (theFiles.Count == 1 && !string.IsNullOrEmpty(croppedFileName)) { newFileName = croppedFileName; } foreach (var formFile in theFiles) { try { if (formFile.Length > 0) { var uploadResult = await _fileManagerService.ProcessFile( formFile, _autoUploadOptions, resizeImages, maxWidth, maxHeight, currentDir, newFileName, true ).ConfigureAwait(false); imageList.Add(uploadResult); } } catch (Exception ex) { _log.LogError(MediaLoggingEvents.FILE_PROCCESSING, ex, ex.StackTrace); } } return(Json(imageList)); }