In cases folder drag and drop is not supported a proper message is displayed

This commit is contained in:
Thomas Müller 2014-04-09 23:32:12 +02:00
parent 2fc9e27ced
commit e8be2ac554
1 changed files with 12 additions and 5 deletions

View File

@ -242,11 +242,18 @@ OC.Upload = {
data.errorThrown = errorMessage;
}
if (file.type === '' && file.size === 4096) {
data.textStatus = 'dirorzero';
data.errorThrown = t('files', 'Unable to upload {filename} as it is a directory or has 0 bytes',
{filename: file.name}
);
// in case folder drag and drop is not supported file will point to a directory
if (!file.type && file.size%4096 === 0 && file.size <= 102400) {
try {
reader = new FileReader();
reader.readAsBinaryString(f);
} catch (NS_ERROR_FILE_ACCESS_DENIED) {
//file is a directory
data.textStatus = 'dirorzero';
data.errorThrown = t('files', 'Unable to upload {filename} as it is a directory or has 0 bytes',
{filename: file.name}
);
}
}
// add size