BrightspaceUILabs / file-uploader

Polymer-based web component for D2L file uploader
Apache License 2.0
4 stars 6 forks source link

Override the message before "browse" #44

Closed zwilson2 closed 3 years ago

zwilson2 commented 7 years ago

I would like to be able to override the _message property with something more specific from my app. Ex. Only ZIP files are able to be dropped it would be nice to have a message that reflects this.

dlockhart commented 7 years ago

Limiting the accepted file types (e.g. "only ZIP" or "only images") could also be functionality that gets built into the file uploader itself. Then it could display a standard message automatically, and handle the validation if the user still dropped the wrong file type.

dbatiste commented 7 years ago

Something to consider re validation of types: LMS has the concept for both allowed file types and restricted file types (defined in DB). If the upload end-point is the LMS and the control is configured to allow "all" file types, it's not really all. There's probably a couple options on how to catch the restricted case - one simple option would be the upload service reports this back upon trying to upload (which I think it does already). Identifying that case before dropping or performing the XHR would require knowing what those restricted types are ahead of time (i.e. client-side).

nicolebezaire commented 7 years ago

I would prefer that the message inside the visual drop target is standard and we deal with file types via messaging external to the component, or handled through the error message available in the component. (There may be exceptions required for individual designs, but I would keep the component standard). Now, I realize that the visual drop target text currently says, Drag and drop a file anywhere on this screen or browse/Browse Files -- and, I don't mind if we simplify this down to, Drag and drop or browse/Browse Files to simplify the proposed option to either enable full-screen drag&drop or limit the drop target to the visual outline.

dlockhart commented 3 years ago

Going to close this as I'll be opening a new issue to track adding the feature of setting a max file size and mime-type (e.g. "only images").