AddUpload při vložení více souborů neodešle korektně formulář

Upozornění: Tohle vlákno je hodně staré a informace nemusí být platné pro současné Nette.
Tirus91
Člen | 199
+
0
-

Narazil jsem na zajímavý problém. V případě, že dám multiple nahrávání souborů a vložím cca 5-x souborů, tak se formulář neodešlě na onSuccess.
Níž přikládám jak presenter, tak i šablonu. Dělám někde chybu? Jak mohu dohledat na čem to selhalo? Tracy nic neodchytí a v logu též nic není.

    protected function createComponentAddFile($name) {
        $form = new \Nette\Application\UI\Form;
        $maxFileSize = $this->system->maxuploadedfilesize;
        $form->setTranslator($this->getTranslator());
        $form->addUpload('file', 'filemanager.label.file', true)
                ->addRule(\Nette\Application\UI\Form::MAX_FILE_SIZE, 'filemanager.message.info.maxfilesize', $maxFileSize);
        $form->addPassword('password', 'filemanager.label.password');
        $form->onSuccess[] = $this->completeUploadFile;
        $form->addSubmit('save', 'buttons.upload');
        return $form;
    }

    public function completeUploadFile(Nette\Application\UI\Form $form, Nette\Utils\ArrayHash $values) {
        \Tracy\Debugger::barDump($form);
        if ($form->isSuccess()) {
            $files = $values->file;
            \Tracy\Debugger::barDump($values->file);
            if (!is_array($values->file)) {
                $files = array($values->file);
            }
            $succ = array();
            $failed = array();
            foreach ($files as $file) {
                if ($file->isOk()) {
                    try {
                        $this->attachment->saveAttachment($file->getTemporaryFile(), null, $file->getName(), null, $values->password);
                        $succ[] = $file->getName();
                    } catch (\Exception $ex) {
                        $failed[] = $file->getName();
                    }
                } else {
                    $failed[] = $file->getName();
                }
            }
            if (sizeof($succ) > 0) {
                $this->flashMessage('filemanager.message.success.addfile', 'success');
                if (sizeof($failed) > 0) {
                    $this->flashMessage(join(";    ", $succ), 'info');
                }
            }
            if (sizeof($failed) > 0) {
                $this->flashMessage('filemanager.message.danger.addfile', 'danger');
                $this->flashMessage(join(";    ", $failed), 'warning');
            }

            $this->redirect('default');
        }
    }
{form addFile}
        <div class="row">
            <div class="col-md-12">
                <div class="box box-solid collapsed-box">
                    <div class="box-header with-border">
                        <h3 class="box-title">{_'filemanager.label.uploadFile'}</h3>
                        <div class="box-tools pull-right">
                            <button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-plus"></i></button>
                        </div>
                    </div><!-- /.box-header -->
                    <div class="box-body">

                        {if $form->hasErrors()}
                            <div class="callout callout-danger">
                                <h4>
                                    <i class="icon fa fa-ban"></i>
                                    {_'system.message.danger.heading'}</h4>
                                    {foreach $form->errors as $error}
                                    <p>{_$error}</p>

                                {/foreach}
                            </div>
                        {/if}
                        <div class="form-group">
                            {label file /}
                            {input file class=>'multiple'}
                        </div>
                        <div class="form-group">
                            {label password /}
                            {input password}
                            <p class="help-block">{_'filemanager.quote.password'}</p>
                        </div>

                        {input save class=>'btn btn-primary'}
                    </div> <!-- /.box-body -->
                </div><!-- /.box -->
            </div><!-- /col-md-12 -->
        </div><!-- /.row -->
    {/form}