feat: increase file upload size limit to 10MiB

Signed-off-by: limited_dev <loginakkisativ@gmail.com>
This commit is contained in:
limited_dev 2023-06-13 07:47:49 +02:00
parent 508510962a
commit 21e20ad2b7
3 changed files with 6 additions and 6 deletions

View file

@ -136,12 +136,12 @@
bool hasImage = selectedFile != null;
int thisGET = b.NumberOfGETs + 1;
b.NumberOfGETs++;
++b.NumberOfGETs;
await BoardsRepository.updateBoardAsync(b);
CommentData commentToCreate;
if (hasImage)
{
Stream stream = selectedFile.OpenReadStream(maxAllowedSize: 512000 * 8); // max 4MB
Stream stream = selectedFile.OpenReadStream(maxAllowedSize: 512000 * 2 * 10); // max 10MB
var file = Path.GetRandomFileName() + "." + selectedFile.Name.Split(".")[selectedFile.Name.Split(".").Length - 1];
var path = $"{env.WebRootPath}/img/dynamic/comment/{@post.Board}/{@file}";
FileStream fs = File.Create(path);

View file

@ -1,5 +1,5 @@
<div class="notesInfo">
<span>The max. image size is 4MiB.</span>
<span>The max. image size is 10MiB.</span>
<br/>
<span>Supported file types are: jpeg, png & gif</span>
<br/>

View file

@ -137,14 +137,14 @@
//TODO Add check if data is image
if (selectedFile == null || selectedFile.Size >= 512000 * 4)
if (selectedFile == null || selectedFile.Size >= 512000 * 2 * 10)
{
hasErr = true;
postErr = "You did not attach a file or the selected file is bigger then the 2MiB file limit.";
postErr = "You did not attach a file or the selected file is bigger then the 10MiB file limit.";
return;
}
Stream stream = selectedFile.OpenReadStream(maxAllowedSize: 512000 * 8); // max 4MB
Stream stream = selectedFile.OpenReadStream(maxAllowedSize: 512000 * 2 * 10); // max 10MB
var file = Path.GetRandomFileName() + "." + selectedFile.Name.Split(".")[selectedFile.Name.Split(".").Length - 1];
var path = $"{env.WebRootPath}/img/dynamic/op/{@board.Tag}/{@file}";
FileStream fs = File.Create(path);