Edwardie Fileupload | Better

User uploads an image via Edwardie. Instead of just saving it, we automatically optimize it.

public async Task<IActionResult> UploadChunk() { var chunk = Request.Form.Files[0]; var fileName = Request.Form["fileName"]; var chunkNumber = int.Parse(Request.Form["chunkNumber"]); var totalChunks = int.Parse(Request.Form["totalChunks"]); var tempPath = Path.Combine(ServerTempPath, fileName); edwardie fileupload better

Queue this via Hangfire or Azure Queue to avoid slowing down the upload acknowledgment. Part 6: Security Hardening for Edwardie A better uploader is a safe uploader. Standard Edwardie often allows users to upload .exe or .aspx files, leading to server compromise. User uploads an image via Edwardie

// Append this chunk to the file using (var stream = new FileStream(tempPath, chunkNumber == 0 ? FileMode.Create : FileMode.Append)) { await chunk.CopyToAsync(stream); } Part 6: Security Hardening for Edwardie A better

return Ok(new { received = chunkNumber }); }

The question on every developer's mind is: How do we make the ?