From aafe149fe3ccc42d26d619ee274852fceacd2207 Mon Sep 17 00:00:00 2001 From: johan Date: Mon, 9 Jan 2023 09:38:03 +0100 Subject: [PATCH] TAILLE DE MA BITE --- static/js/main.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/static/js/main.js b/static/js/main.js index 958808a..dd6cfb4 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -616,6 +616,11 @@ $('.close').click((e) => { $('#treasure-popup-button').click((e) => { var fr = new FileReader(); + let f = $('#treasure-popup-image').prop('files')[0]; + if(f.size > 10**7) { + alert('Le fichier est beaucoup trop gros !'); + return; + } var indata = { uid: localStorage.getItem('user'), @@ -648,7 +653,9 @@ $('#treasure-popup-button').click((e) => { }); }); - fr.readAsDataURL($('#treasure-popup-image').prop('files')[0]); + + + fr.readAsDataURL(f); }); $('#demande-button').click(function () {