Skip to content

Commit

Permalink
add max file size to verifInputs
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo-Brd committed Dec 5, 2024
1 parent 822371e commit d156803
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 1 deletion.
Binary file modified Backend/database.sqlite
Binary file not shown.
Binary file added Backend/images/Toji_(1)1733393738698.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Backend/images/wp47959231733244422429.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Backend/images/wp47959231733349384170.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion FrontEnd/scripts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ export function resetInputs(modal) {

/* verif the modal inputs are filled */
export function verifInputs(fileInput, titleInput, categoryInput) {
const MAX_FILE_SIZE = 4 * 1024 * 1024;

const inputs = [
{ element: fileInput, isValid: el => el.files && el.files.length > 0 },
{ element: fileInput, isValid: el => el.files && el.files.length > 0 && el.files[0].size <= MAX_FILE_SIZE },
{ element: titleInput, isValid: el => el.value.trim() !== "" },
{ element: categoryInput, isValid: el => el.value }
];
Expand Down

0 comments on commit d156803

Please sign in to comment.