Skip to content

Commit 2baf638

Browse files
author
Steve Salas
committed
Add client-side validation for upload file size
1 parent c0e6c3b commit 2baf638

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

codepulse/src/main/resources/toserve/pages/ProjectInputForm/ProjectInputForm.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,15 @@ $(document).ready(function(){
8282
url: uploadUrl,
8383
dropZone: fileDropzone,
8484
add: function(e, data){
85-
// use this `data` as the current file data.
86-
// this will be used once the form is submitted.
87-
projectFile.set(data)
85+
if (data.files[0].size > 524288000) {
86+
alert('The file you specified exceeds the maximum file size (500 MB).');
87+
projectFile.set(null);
88+
return
89+
}
90+
91+
// use this `data` as the current file data.
92+
// this will be used once the form is submitted.
93+
projectFile.set(data)
8894
},
8995
formData: function(){
9096
var name = projectName.get()

0 commit comments

Comments
 (0)