本文整理汇总了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);