本文整理汇总了PHP中HtmlForm::addFileUpload方法的典型用法代码示例。如果您正苦于以下问题:PHP HtmlForm::addFileUpload方法的具体用法?PHP HtmlForm::addFileUpload怎么用?PHP HtmlForm::addFileUpload使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HtmlForm
的用法示例。
在下文中一共展示了HtmlForm::addFileUpload方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: HtmlPage
// set headline
if ($getItemId == $gCurrentUser->getValue('inv_id')) {
$headline = $gL10n->get('PRO_EDIT_MY_PROFILE_PICTURE');
} else {
$headline = $gL10n->get('PRO_EDIT_PROFILE_PIC_FROM', $inventory->getValue('FIRST_NAME'), $inventory->getValue('LAST_NAME'));
}
$gNavigation->addUrl(CURRENT_URL, $headline);
// create html page object
$page = new HtmlPage($headline);
// add back link to module menu
$profilePhotoMenu = $page->getMenu();
$profilePhotoMenu->addItem('menu_item_back', $gNavigation->getPreviousUrl(), $gL10n->get('SYS_BACK'), 'back.png');
// show form
$form = new HtmlForm('upload_files_form', $g_root_path . '/adm_program/modules/inventory/item_photo_edit.php?mode=upload&inv_id=' . $getItemId, $page, array('enableFileUpload' => true));
$form->addCustomContent($gL10n->get('PRO_CURRENT_PICTURE'), '<img class="imageFrame" src="item_photo_show.php?inv_id=' . $getItemId . '" alt="' . $gL10n->get('PRO_CURRENT_PICTURE') . '" />');
$form->addFileUpload('userfile', $gL10n->get('PRO_CHOOSE_PHOTO'), array('helpTextIdLabel' => 'profile_photo_up_help'));
$form->addSubmitButton('btn_upload', $gL10n->get('PRO_UPLOAD_PHOTO'), array('icon' => THEME_PATH . '/icons/photo_upload.png', 'class' => ' col-sm-offset-3'));
// add form to html page and show page
$page->addHtml($form->show(false));
$page->show();
} elseif ($getMode == 'upload') {
/*****************************Foto zwischenspeichern bestaetigen***********************************/
//Dateigroesse
if ($_FILES['userfile']['error'][0] == 1) {
$gMessage->show($gL10n->get('PRO_PHOTO_FILE_TO_LARGE', round(admFuncMaxUploadSize() / pow(1024, 2))));
}
//Kontrolle ob Fotos ausgewaehlt wurden
if (file_exists($_FILES['userfile']['tmp_name'][0]) == false) {
$gMessage->show($gL10n->get('PRO_PHOTO_NOT_CHOOSEN'));
}
//Dateiendung
示例2: HtmlPage
if ($getUserId == $gCurrentUser->getValue('usr_id')) {
$headline = $gL10n->get('PRO_EDIT_MY_PROFILE_PICTURE');
} else {
$headline = $gL10n->get('PRO_EDIT_PROFILE_PIC_FROM', $user->getValue('FIRST_NAME'), $user->getValue('LAST_NAME'));
}
$gNavigation->addUrl(CURRENT_URL, $headline);
// create html page object
$page = new HtmlPage($headline);
// add back link to module menu
// @ptabaden: Changed Back Icon
$profilePhotoMenu = $page->getMenu();
$profilePhotoMenu->addItem('menu_item_back', $gNavigation->getPreviousUrl(), '<i class="fa fa-arrow-left" alt="' . $gL10n->get('SYS_BACK') . '" title="' . $gL10n->get('SYS_BACK') . '"></i><div class="iconDescription">' . $gL10n->get('SYS_BACK') . '</div>', '');
// show form
$form = new HtmlForm('upload_files_form', $g_root_path . '/adm_program/modules/profile/profile_photo_edit.php?mode=upload&usr_id=' . $getUserId, $page, array('enableFileUpload' => true));
$form->addCustomContent($gL10n->get('PRO_CURRENT_PICTURE'), '<img class="imageFrame" src="profile_photo_show.php?usr_id=' . $getUserId . '" alt="' . $gL10n->get('PRO_CURRENT_PICTURE') . '" />');
$form->addFileUpload('foto_upload_file', $gL10n->get('PRO_CHOOSE_PHOTO'), array('allowedMimeTypes' => array('image/jpeg', 'image/png'), 'helpTextIdLabel' => 'profile_photo_up_help'));
$form->addSubmitButton('btn_upload', $gL10n->get('PRO_UPLOAD_PHOTO'), array('icon' => THEME_PATH . '/icons/photo_upload.png', 'class' => ' col-sm-offset-3'));
// add form to html page and show page
$page->addHtml($form->show(false));
$page->show();
} elseif ($getMode === 'upload') {
/*****************************Foto zwischenspeichern bestaetigen***********************************/
// File size
if ($_FILES['userfile']['error'][0] == 1) {
$gMessage->show($gL10n->get('PRO_PHOTO_FILE_TO_LARGE', round(admFuncMaxUploadSize() / pow(1024, 2))));
}
// Kontrolle ob Fotos ausgewaehlt wurden
if (!file_exists($_FILES['userfile']['tmp_name'][0])) {
$gMessage->show($gL10n->get('PRO_PHOTO_NOT_CHOOSEN'));
}
// File ending
示例3: unset
$form_values = $_SESSION['import_request'];
unset($_SESSION['import_request']);
} else {
$form_values['user_import_mode'] = 1;
$form_values['import_coding'] = 'iso-8859-1';
$form_values['import_role_id'] = 0;
}
// create html page object
$page = new HtmlPage($headline);
// add back link to module menu
$importMenu = $page->getMenu();
$importMenu->addItem('menu_item_back', $gNavigation->getPreviousUrl(), $gL10n->get('SYS_BACK'), 'back.png');
// show form
$form = new HtmlForm('import_users_form', $g_root_path . '/adm_program/modules/members/import_function.php', $page, array('enableFileUpload' => true));
$form->addStaticControl('format', $gL10n->get('MEM_FORMAT'), 'CSV');
$form->addFileUpload('userfile', $gL10n->get('MEM_CHOOSE_FILE'), array('property' => FIELD_REQUIRED, 'allowedMimeTypes' => array('text/comma-separated-values')));
$selectBoxEntries = array('iso-8859-1' => $gL10n->get('SYS_ISO_8859_1'), 'utf-8' => $gL10n->get('SYS_UTF8'));
$form->addSelectBox('import_coding', $gL10n->get('MEM_CODING'), $selectBoxEntries, array('property' => FIELD_REQUIRED, 'defaultValue' => $form_values['import_coding']));
// add a selectbox to the form where the user can choose a role from all roles he could see
// first read all relevant roles from database and create an array with them
$condition = '';
if (!$gCurrentUser->manageRoles()) {
// keine Rollen mit Rollenzuordnungsrecht anzeigen
$condition .= ' AND rol_assign_roles = 0 ';
}
if (!$gCurrentUser->isWebmaster()) {
// Webmasterrolle nicht anzeigen
$condition .= ' AND rol_webmaster = 0 ';
}
$sql = 'SELECT * FROM ' . TBL_ROLES . ', ' . TBL_CATEGORIES . '
WHERE rol_valid = 1
示例4: unset
$form_values = $_SESSION['import_request'];
unset($_SESSION['import_request']);
} else {
$form_values['user_import_mode'] = 1;
$form_values['import_coding'] = 'iso-8859-1';
$form_values['import_role_id'] = 0;
}
// create html page object
$page = new HtmlPage($headline);
// add back link to module menu
$importMenu = $page->getMenu();
$importMenu->addItem('menu_item_back', $gNavigation->getPreviousUrl(), $gL10n->get('SYS_BACK'), 'back.png');
// show form
$form = new HtmlForm('import_users_form', $g_root_path . '/adm_program/modules/members/import_function.php', $page, array('enableFileUpload' => true));
$form->addStaticControl('format', $gL10n->get('MEM_FORMAT'), 'CSV');
$form->addFileUpload('userfile', $gL10n->get('MEM_CHOOSE_FILE'), array('property' => FIELD_REQUIRED));
$selectBoxEntries = array('iso-8859-1' => $gL10n->get('SYS_ISO_8859_1'), 'utf-8' => $gL10n->get('SYS_UTF8'));
$form->addSelectBox('import_coding', $gL10n->get('MEM_CODING'), $selectBoxEntries, array('property' => FIELD_REQUIRED, 'defaultValue' => $form_values['import_coding']));
// add a selectbox to the form where the user can choose a role from all roles he could see
// first read all relevant roles from database and create an array with them
$condition = '';
if ($gCurrentUser->manageRoles() == false) {
// keine Rollen mit Rollenzuordnungsrecht anzeigen
$condition .= ' AND rol_assign_roles = 0 ';
}
if ($gCurrentUser->isWebmaster() == false) {
// Webmasterrolle nicht anzeigen
$condition .= ' AND rol_webmaster = 0 ';
}
$sql = 'SELECT * FROM ' . TBL_ROLES . ', ' . TBL_CATEGORIES . '
WHERE rol_valid = 1
示例5: array
$form->addInput('mailfrom', $gL10n->get('MAI_YOUR_EMAIL'), $form_values['mailfrom'], array('maxLength' => 50, 'property' => FIELD_REQUIRED));
}
// show option to send a copy to your email address only for registered users because of spam abuse
if ($gValidLogin) {
$form->addCheckbox('carbon_copy', $gL10n->get('MAI_SEND_COPY'), $form_values['carbon_copy']);
}
// if preference is set then show a checkbox where the user can request a delivery confirmation for the email
if ($gCurrentUser->getValue('usr_id') > 0 && $gPreferences['mail_delivery_confirmation'] == 2 || $gPreferences['mail_delivery_confirmation'] == 1) {
$form->addCheckbox('delivery_confirmation', $gL10n->get('MAI_DELIVERY_CONFIRMATION'), $form_values['delivery_confirmation']);
}
$form->closeGroupBox();
$form->openGroupBox('gb_mail_message', $gL10n->get('SYS_MESSAGE'));
$form->addInput('subject', $gL10n->get('MAI_SUBJECT'), $form_values['subject'], array('maxLength' => 77, 'property' => FIELD_REQUIRED));
// Nur eingeloggte User duerfen Attachments anhaengen...
if ($gValidLogin && $gPreferences['max_email_attachment_size'] > 0 && ini_get('file_uploads') == '1') {
$form->addFileUpload('btn_add_attachment', $gL10n->get('MAI_ATTACHEMENT'), array('enableMultiUploads' => true, 'multiUploadLabel' => $gL10n->get('MAI_ADD_ATTACHEMENT'), 'hideUploadField' => true, 'helpTextIdLabel' => array('MAI_MAX_ATTACHMENT_SIZE', Email::getMaxAttachementSize('mb'))));
}
// add textfield or ckeditor to form
if ($gValidLogin == true && $gPreferences['mail_html_registered_users'] == 1) {
$form->addEditor('msg_body', null, $form_values['msg_body'], array('property' => FIELD_REQUIRED));
} else {
$form->addMultilineTextInput('msg_body', $gL10n->get('SYS_TEXT'), null, 10, array('property' => FIELD_REQUIRED));
}
$form->closeGroupBox();
// if captchas are enabled then visitors of the website must resolve this
if (!$gValidLogin && $gPreferences['enable_mail_captcha'] == 1) {
$form->openGroupBox('gb_confirmation_of_input', $gL10n->get('SYS_CONFIRMATION_OF_INPUT'));
$form->addCaptcha('captcha', $gPreferences['captcha_type']);
$form->closeGroupBox();
}
$form->addSubmitButton('btn_send', $gL10n->get('SYS_SEND'), array('icon' => THEME_PATH . '/icons/email.png'));
示例6: strStripSlashesDeep
$gMessage->show($gL10n->get('SYS_SERVER_NO_UPLOAD'));
}
$gNavigation->addUrl(CURRENT_URL, $headline);
if (isset($_SESSION['download_request'])) {
$form_values = strStripSlashesDeep($_SESSION['download_request']);
unset($_SESSION['download_request']);
} else {
$form_values['new_name'] = null;
$form_values['new_description'] = null;
}
try {
// get recordset of current folder from databse
$folder = new TableFolder($gDb);
$folder->getFolderForDownload($getFolderId);
} catch (AdmException $e) {
$e->showHtml();
}
$parentFolderName = $folder->getValue('fol_name');
// create html page object
$page = new HtmlPage($headline);
// add back link to module menu
$downloadUploadMenu = $page->getMenu();
$downloadUploadMenu->addItem('menu_item_back', $gNavigation->getPreviousUrl(), $gL10n->get('SYS_BACK'), 'back.png');
$page->addHtml('<p class="lead">' . $gL10n->get('DOW_UPLOAD_TO_FOLDER', $parentFolderName) . '</p>');
// show form
$form = new HtmlForm('upload_files_form', $g_root_path . '/adm_program/modules/downloads/download_function.php?mode=1&folder_id=' . $getFolderId, $page, array('enableFileUpload' => true));
$form->addFileUpload('add_files', $gL10n->get('DOW_CHOOSE_FILE'), array('enableMultiUploads' => true, 'multiUploadLabel' => $gL10n->get('DOW_UPLOAD_ANOTHER_FILE')));
$form->addSubmitButton('btn_upload', $gL10n->get('SYS_UPLOAD'), array('icon' => THEME_PATH . '/icons/page_white_upload.png', 'class' => ' col-sm-offset-3'));
// add form to html page and show page
$page->addHtml($form->show(false));
$page->show();