dealing with invalid drag and drops

This commit is contained in:
Abhinav Adduri 2017-07-24 12:42:16 -07:00
parent fa1f0208a4
commit a576cc0198
2 changed files with 8 additions and 0 deletions

View File

@ -143,6 +143,13 @@ $(document).ready(function() {
let file = ''; let file = '';
if (event.type === 'drop') { if (event.type === 'drop') {
if (!event.originalEvent.dataTransfer.files[0]) {
$('.upload-window').removeClass('ondrag');
document.l10n.formatValue('uploadValidFile').then(str => {
alert(str);
});
return;
}
if ( if (
event.originalEvent.dataTransfer.files.length > 1 || event.originalEvent.dataTransfer.files.length > 1 ||
event.originalEvent.dataTransfer.files[0].size === 0 event.originalEvent.dataTransfer.files[0].size === 0

View File

@ -11,6 +11,7 @@ uploadPageSizeMessage = For the most reliable operation, its best to keep you
uploadPageBrowseButton = Select a file on your computer uploadPageBrowseButton = Select a file on your computer
.title = {uploadPageBrowseButtonTitle} .title = {uploadPageBrowseButtonTitle}
uploadPageMultipleFilesAlert = Uploading multiple files or a folder is currently not supported. uploadPageMultipleFilesAlert = Uploading multiple files or a folder is currently not supported.
uploadValidFile = Please drag a valid file to upload.
uploadPageBrowseButtonTitle = Upload file uploadPageBrowseButtonTitle = Upload file