private async void Upload(FileSystemEventArgs e) { if (options.UploadDelay > 0) { await Task.Delay(options.UploadDelay); } await cloudStorageService.UploadAsync(e.FullPath, $"{options.RemotePath}/{e.Name}"); }
public async Task <ActionResult <CloudImageViewModel> > UploadImage() { try { var file = Request.Form.Files[0]; if (file == null) { logger.LogError($"File object sent from client is null"); return(BadRequest("File object is null")); } return(await storageService.UploadAsync(file).ConfigureAwait(false)); } catch (Exception ex) { logger.LogError($"Something went wrong inside UploadImage action: {ex.Message}"); return(StatusCode(500, "Internal server error")); } }