gfdsgfds
This commit is contained in:
@@ -89,7 +89,7 @@ export const handleBrandImageUpload = async (req, res) => {
|
||||
return sendJson(res, { success: false, msg: 'Invalid content type — multipart boundary missing' }, 400);
|
||||
}
|
||||
|
||||
const body = await collectBody(req, 5 * 1024 * 1024); // 5 MB hard cap
|
||||
const body = await collectBody(req, 10 * 1024 * 1024); // 10 MB request body cap
|
||||
const parts = parseMultipart(body, boundaryMatch[1]);
|
||||
const file = parts.file;
|
||||
|
||||
@@ -97,12 +97,12 @@ export const handleBrandImageUpload = async (req, res) => {
|
||||
return sendJson(res, { success: false, msg: 'No file provided' }, 400);
|
||||
}
|
||||
|
||||
// 2 MB soft cap
|
||||
const maxSize = 2 * 1024 * 1024;
|
||||
// 5 MB cap
|
||||
const maxSize = 5 * 1024 * 1024;
|
||||
if (file.data.length > maxSize) {
|
||||
return sendJson(res, {
|
||||
success: false,
|
||||
msg: `File too large. Maximum is 2 MB, got ${(file.data.length / 1024 / 1024).toFixed(2)} MB`
|
||||
msg: `File too large. Maximum is 5 MB, got ${(file.data.length / 1024 / 1024).toFixed(2)} MB`
|
||||
}, 400);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user