Skip to content

Commit

Permalink
Add file size too large error for file uploads
Browse files Browse the repository at this point in the history
  • Loading branch information
taheralfayad committed Apr 26, 2024
1 parent a6f101c commit 788731b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions assets/js/Components/FilesModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,13 @@ class FilesModal extends React.Component {
return
}

if(file.size > 1024 * 1024 * 10) {
this.addMessage({severity: 'error', message: this.props.t('msg.file.replace.file_size'), timeout: 5000})
this.setState({ replaceFileObj: null })
this.forceUpdate()
return
}

this.setState({ replaceFileObj: file })
}

Expand Down
3 changes: 2 additions & 1 deletion translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
"msg.sync.started": "Course scan started.",
"msg.sync.failed": "Course scan failed. Course is missing.",
"msg.file.replace.file_type": "File type not accepted. Please input a file with the correct filetype.",
"msg.file.replace.file_size": "File size too large. Please input a file with a size less than 10MB",
"msg.sync.completed": "Course scan completed.",
"msg.sync.course_inactive": "Course scan failed. Course is inactive.",

Expand Down Expand Up @@ -384,4 +385,4 @@

"rule.label.SearchKeyWord": "Keyword found",
"rule.desc.SearchKeyWord": "The keyword has been found"
}
}

0 comments on commit 788731b

Please sign in to comment.