本文整理匯總了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;
}