本文整理汇总了PHP中Nette\Application\UI\Form::addMultipleFileUpload方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::addMultipleFileUpload方法的具体用法?PHP Form::addMultipleFileUpload怎么用?PHP Form::addMultipleFileUpload使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Application\UI\Form
的用法示例。
在下文中一共展示了Form::addMultipleFileUpload方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createComponentForm
public function createComponentForm($name)
{
$form = new Form($this, $name);
$form->getElementPrototype()->class[] = "ajax";
// activate AJAX in http://addons.nette.org/vojtech-dobes/nette-ajax-js
$form->addText("textField", "Text field")->addRule(Form::FILLED, "This is required text field.");
$form->addMultipleFileUpload("upload", "Attachments");
//->addRule('MultipleFileUpload\MultipleFileUpload::validateFilled',"You have to upload at least one file!")
//->addRule('MultipleFileUpload\MultipleFileUpload::validateFileSize',"Files are together too large.",100*1024);
//$form->addMultipleFileUpload("upload2","Second file uploader");
$form->addSubmit("send", "Submit your form!");
$form->onSuccess[] = $this->handleFormSuccess;
// Invalidace snippetů
$form->onError[] = array($this, "handleRedrawForm");
$form->onSuccess[] = array($this, "handleRedrawForm");
}
示例2: createComponentUploadPhotosForm
/**
* Form for uploading photos
* Can only be created on the Generate action page and accessed
* by somebody with generate privileges or higher
*
* @Privilege('generate')
* @Action('generate')
*/
protected function createComponentUploadPhotosForm()
{
$form = new Form();
$form->addProtection('Vypršel časový limit, odešlete formulář znovu');
$form->getElementPrototype()->class[] = "ajax";
$form->addHidden('id');
$form->addMultipleFileUpload("upload", "Fotky:")->addRule("MultipleFileUpload::validateFilled", "Musíte odeslat alespoň jeden soubor!")->addRule("MultipleFileUpload::validateFileSize", "Soubory jsou dohromady moc veliké!", 100 * 1024 * 1024);
//100MiB
if ($this->user->isAllowed('Admin:Default:Chronicle', 'show')) {
$form->addCheckbox('showchronicle', 'Zobrazit kroniku')->setDefaultValue(TRUE);
}
$form->addSubmit("send", "Odeslat");
$form->onSuccess[] = $this->uploadPhotosFormSucceded;
// snippet invalidation
$form->onError[] = $this->handleRedrawForm;
$form->onSuccess[] = $this->handleRedrawForm;
return $form;
}