-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Asset Manager Upload / Store file Limit #2227
Conversation
…g the user from exceeding their limit.
} | ||
if (config.uploadMaxFileSize > 0 && config.uploadMaxFileSize <= fileSize / 1024) { | ||
alert(config.uploadMaxFileSizeAlertText || 'The file(s) you have selected to add exceed your space limit'); | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO, instead of those 2 options, I'd prefer something like config.beforeUpload
callback where the user can define its own logic and raise its own UI (we shouldn't use alert
in the framework, if you feel the need to do it, it means you have to create a customizable callback for the user). Eg.
const { beforeUpload } = config;
const beforeUploadRes = beforeUpload &&
beforeUpload({ fileSize, files, ...maybeOtherOptions });
if (beforeUploadRes === false) return;
@@ -115,12 +115,20 @@ export default Backbone.View.extend( | |||
body.append(param, params[param]); | |||
} | |||
|
|||
var fileSize = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use let
@artf, I made the changes you requested; which makes this a lot cleaner and better for me too. Thank you. Do I need to do a new pull request or is this sufficient? |
No, it's perfect now, thank you very much |
asset manager added config & logic to set max file(s) size; preventing the user from exceeding their limit.