public async Task <IActionResult> UploadTempImage(IFormFile image) { int userId; try { userId = IdentityHelper.GetUserId(User); } catch (UnauthorizedAccessException) { return(Unauthorized()); } var uploadModel = new UploadTempImage( userId, Path.Combine(_webHostEnvironment.ContentRootPath, "storage", "temp"), $"users/{userId}/recipes", "recipe") { Length = image.Length, FileName = image.FileName }; await image.CopyToAsync(uploadModel.File); string tempImageUri = await _cdnService.UploadTempAsync(uploadModel, _uploadTempImageValidator); return(StatusCode(201, new { tempImageUri })); }