Fileupload element (small) bugs

tali

Member
1?) I limit the size to 16384 (16*1024) Kb. A file of 16476347 bytes will not be accepted. It is said as too big despite 16384 * 1024 = 16777216
In fact it appears that the file is uploaded on the server, just not included in the fabrik table.

2?) If I limit to 1 (or whatever) the number of files, the surplus, as expected, do not appear in the fabrik table
but in fact are uploaded on the server.

Also, when the limit is reached (1 in my case), if I'm not wrong, the upload a file button should disappear.
I obtain this with a Javascript plugin on load the element
Code:
jQuery(document).ready(function ()
{
    var maxfiles = 1;
    setInterval(function() {
        if (jQuery('#mytablename_repeat___myelementname_dropList_container  tr').length > 1 + maxfiles)
            jQuery('#mytablename_repeat___myelementname_dropList_container > table > tfoot').hide();  
        else
            jQuery('#mytablename_repeat___myelementname_dropList_container > table > tfoot').show();  
    }, 1000);
});
 
Last edited:
1 should be fixed as of this commit:

https://github.com/Fabrik/fabrik/commit/fd16c837be0d87e2f94d1940295716f2e8c133c6

... we were using 1000 instead of 1024 as the multiplier.

2 & 3 are tricky, because the user could upload a file, then delete another one. And with AJAX uploading, the files are uploaded from the form, rather than during submission, then the limits counted during submission.

We could probably do a better job of it, with some events that hide/show the button dynamically depending on the number of files in the widget (so if it's at max when the page loads, the button hides, then they delete a file, the button shows again). It's one of those thigs I'll probably add next time I do any serious surgery on that element.

I also want to modify how we handle uploading from AJAX, so we only load to a tmp folder through AJAX, then move the file after submission to the actual folder, if appropriate. But right now, it gets uploaded and moved in the AJAX call.

-- hugh
 
Thank you for a so quick reply and for the commit.

For 3, I had edited the code after testing precisely what you pointed out as adding/deleting or adding/canceling files before submitting the form. Plus the code explicitly takes in account a maxfiles value.
I would not say that this solution is optimal, but it works.

And for 2, indeed a tmp folder will be a nice improvement.
 
Yeah, but I loathe setInterval functions. I'll take a look next time I'm in that code, and look at putting some actual events on the upload button.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top