Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attachments upload - files count limit check #5483

Closed
skiner68 opened this issue Oct 19, 2016 · 3 comments
Closed

Attachments upload - files count limit check #5483

skiner68 opened this issue Oct 19, 2016 · 3 comments

Comments

@skiner68
Copy link

Hello,
max. count of attachments uploaded at once is limited by PHP directive max_file_uploads. I think user should be informed about this and count of selected files should be checked by Javascript after selection (there is a html file input with multiple option in attachment composer form).

If user selects more files than actual max_file_uploads limit, only "max_file_uploads" files are uploaded, others are ignored silently. This is an bug in user interface.

I have made a temporary solution using plugin template hook to let user know about the limit, sample code here for others...

$this->add_hook('template_object_composeattachmentform', array($this, 'fix_attachment_form'));
.....
public function fix_attachment_form($params)
    {
        $text_params = array(
            'name' => 'attachment_count_limit',
            'vars' => array(
                'limit' => ini_get('max_file_uploads')
        ));

        $hook = '</form>';
        $new = '<div class="hint">' . $this->gettext($text_params) . '</div>' . $hook;

        $params['content'] = str_replace($hook, $new, $params['content']);

        return $params;
    }

attach

@alecpl
Copy link
Member

alecpl commented Oct 19, 2016

We should display an error and abort upload. In git-master version we don't really have a place to display the hint as you proposed and I think the hint itself is not so much important.

@skiner68
Copy link
Author

Thanks for your reply 👍 Yes, the hint is less important then some error info. But it was easier for me to implement using plugin hooks.

@alecpl
Copy link
Member

alecpl commented Oct 20, 2016

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants