public async Task <IActionResult> CreateUpload() { var user = User.FindFirstValue(ClaimTypes.Name); var data = await Request.Body.ReadAllTextAsync(); var definition = data.FromJsonString <CDNFileDefinition>(); _logger.Log(LogLevel.Information, $"Creating File upload {definition.OriginalFileName}"); definition = await _sql.CreateAuthoredFile(definition, user); using (var client = await GetBunnyCdnFtpClient()) { await client.CreateDirectoryAsync($"{definition.MungedName}"); await client.CreateDirectoryAsync($"{definition.MungedName}/parts"); } await _discord.Send(Channel.Ham, new DiscordMessage() { Content = $"{user} has started uploading {definition.OriginalFileName} ({definition.Size.ToFileSizeString()})" }); return(Ok(definition.ServerAssignedUniqueId)); }
public async Task <IActionResult> CreateUpload() { var user = User.FindFirstValue(ClaimTypes.Name); var data = await Request.Body.ReadAllTextAsync(); var definition = data.FromJsonString <CDNFileDefinition>(); _logger.Log(LogLevel.Information, $"Creating File upload {definition.OriginalFileName}"); definition = await _sql.CreateAuthoredFile(definition, user); return(Ok(definition.ServerAssignedUniqueId)); }