BrianNLD

New Member
YetiShare User
YetiShare Supporter
Hello,

For my users I configured a maximum filesize of 1GB. After that I tried to upload a 2GB zip file which started uploading fine. After uploading reached 100% I got an error that the file exceeded the maximum filesize. It looks like Yetishare doesn't check the filesize before uploading.

I tested the same thing with the remote URL upload, and here it works fine. Yetishare checks the filesize before it starts downloading the file. So it seems like the check is missing if you upload from your computer.

It it possible to also add this check when you upload from your own computer? It's a bit more user-friendly and saves bandwidth. Or is it not possible because the files are uploaded in chunks?

Staff member
It should indeed alert before uploading. It looks like the latest uploader code ignores the property. You can use the code below to add it back in. Via:

Find:

JavaScript:
.on('fileuploadadd', function (e, data) {
After replace:

JavaScript:
{% if acceptedFileTypes|length > 0 %}
var acceptFileTypes = /^({{ acceptedFileTypesUploaderStr }})$/i; for(i in data.originalFiles) { fileExtension = data.originalFiles[i]['name'].substr(data.originalFiles[i]['name'].lastIndexOf('.')+1); if(!acceptFileTypes.test(fileExtension)) { alert("{{ t('file_upload_file_type_not_allowed', 'File type not allowed')|escape("js") }} (\""+data.originalFiles[i]['name']+"\")"); return false; } } {% endif %} With: JavaScript: var uploadErrors = []; {% if acceptedFileTypes|length > 0 %} var acceptFileTypes = /^({{ acceptedFileTypesUploaderStr }})$/i;
{% endif %}

for(i in data.originalFiles)
{
}

{% if acceptedFileTypes|length > 0 %}
fileExtension = data.originalFiles[i]['name'].substr(data.originalFiles[i]['name'].lastIndexOf('.')+1);
if(!acceptFileTypes.test(fileExtension)) {
}
{% endif %}
}

return false;
}
I'll make a note to review this for the next release.

BrianNLD

BrianNLD

New Member
YetiShare User
YetiShare Supporter
It should indeed alert before uploading. It looks like the latest uploader code ignores the property. You can use the code below to add it back in. Via:

Find:

JavaScript:
.on('fileuploadadd', function (e, data) {
After replace:

JavaScript:
{% if acceptedFileTypes|length > 0 %}
var acceptFileTypes = /^({{ acceptedFileTypesUploaderStr }})$/i; for(i in data.originalFiles) { fileExtension = data.originalFiles[i]['name'].substr(data.originalFiles[i]['name'].lastIndexOf('.')+1); if(!acceptFileTypes.test(fileExtension)) { alert("{{ t('file_upload_file_type_not_allowed', 'File type not allowed')|escape("js") }} (\""+data.originalFiles[i]['name']+"\")"); return false; } } {% endif %} With: JavaScript: var uploadErrors = []; {% if acceptedFileTypes|length > 0 %} var acceptFileTypes = /^({{ acceptedFileTypesUploaderStr }})$/i;
{% endif %}

for(i in data.originalFiles)
{
}

{% if acceptedFileTypes|length > 0 %}
fileExtension = data.originalFiles[i]['name'].substr(data.originalFiles[i]['name'].lastIndexOf('.')+1);
if(!acceptFileTypes.test(fileExtension)) {
}
{% endif %}
}

}