本文整理匯總了PHP中Browser::wasFileUploaded方法的典型用法代碼示例。如果您正苦於以下問題:PHP Browser::wasFileUploaded方法的具體用法?PHP Browser::wasFileUploaded怎麽用?PHP Browser::wasFileUploaded使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Browser
的用法示例。
在下文中一共展示了Browser::wasFileUploaded方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Horde_Form_Renderer
}
}
break;
}
}
// form configuration
$vars =& Variables::getDefaultVariables();
$renderer =& new Horde_Form_Renderer();
$form =& Horde_Form::singleton('NewNWNModule', $vars);
$valid = $form->validate($vars);
if ($valid) {
// get the information about the file
$form->getInfo($vars, $info);
if (!empty($info['module']['file'])) {
// as long as it was uploaded and there is information
if (!is_a(Browser::wasFileUploaded('module'), 'PEAR_Error') && filesize($info['module']['file'])) {
// check the file for validity
$extension = substr($info['module']['name'], -3);
if ($extension == "mod" || $extension == "MOD") {
$moduleOutputName = escapeshellcmd($moduleDir . $info['module']['name']);
// do not overwrite files
if (file_exists($moduleOutputName)) {
$notification->push(_("Cannot overwrite existing module!"), 'horde.error');
} else {
// get the file data
$fp = fopen($info['module']['file'], 'r');
$data = fread($fp, filesize($info['module']['file']));
fclose($fp);
// write the data to the output dir
$fp = @fopen($moduleOutputName, 'wb');
@fwrite($fp, $data);