I am looking to improve the feedback given to a user when they use my file upload element on BreezingForms.
It is setup for HTML5 uploads with flash disabled and a file size limit of 5mb. This all functions fine by default, but users who try to upload larger files... well, it simply fails to upload with no messages or error to tell them what they have done wrong. I have a tooltip warning them of the size limit, but many people will simply be baffled anyway.
So, I need to communicate to the user on an attempt to upload. I have looked for some solutions and believe I will need to do a javascript check of the filesize in the element's actionscript, then throw an error message, but I don't know enough about the file upload element's structure to get started.
Something fairly simple, like:
function ff_upload_action(element, action)
{
switch (action) {
case 'click': //On selection of a file, may not be click
if(element->value->filesize > 5242880)
{
message = " File selected is too large to upload. Please select an image of size 5Mb or less.\n";
}
break;
default:;
} // switch
return message;
} // ff_upload_action
So, basically, I need to ask about how to check the filesize on upload and make the determination on the file selection.