本文整理汇总了PHP中FileHelper::upload方法的典型用法代码示例。如果您正苦于以下问题:PHP FileHelper::upload方法的具体用法?PHP FileHelper::upload怎么用?PHP FileHelper::upload使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileHelper
的用法示例。
在下文中一共展示了FileHelper::upload方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleFileUpload
/**
* Override parent
*/
function handleFileUpload($fileParameters, $id)
{
$filename = NULL;
if (array_key_exists($this->parameterFile, $_FILES) and array_key_exists('name', $_FILES[$this->parameterFile]) and $_FILES[$this->parameterFile]['name'] != '') {
$fileHelper = new FileHelper();
$filename = $fileHelper->upload($this->fileBasename, $id, $_FILES[$this->parameterFile]);
}
return $filename;
}
示例2: actionIndex
/**
* 管理员上传
*/
function actionIndex()
{
$name = $_REQUEST['field'];
if (!$name) {
exit;
}
$file = new FileHelper();
$file->uid = Yii::app()->user->id;
$file->admin = 1;
$rt = $file->upload();
if (!$rt) {
return;
}
$new[] = $rt;
$out = FileHelper::input($new, $name);
echo $out;
exit;
}
示例3: handleFileUpload
/**
* Override parent
*/
function handleFileUpload($fileParameters, $id)
{
$filename = NULL;
if (array_key_exists($this->parameterFile, $_FILES) and array_key_exists('name', $_FILES[$this->parameterFile]) and $_FILES[$this->parameterFile]['name'] != '') {
$fileHelper = new FileHelper();
// hack pour pouvoir avoir la catégorie
$filename = $this->fileBasename;
/*if (isset($_POST["object_category"])) {
$category = $_POST["object_category"];
$filename = $category ."_".self::fileBasename;
}*/
$filename = $fileHelper->upload($filename, $id, $_FILES[$this->parameterFile]);
}
return $filename;
}
示例4: uploadFiles
/**
+++Method Helpers
*/
private function uploadFiles($model, $modelName)
{
$attributes = $this->fileAttributes($model->edit);
foreach ($attributes as $key => $attribute) {
$name = InputFactory::getName($key, $attribute);
$imagePath = FileHelper::upload($model, $modelName, $name, $attribute, true);
if ($imagePath !== false) {
$model->{$name} = $imagePath["fileName"];
}
}
return $model;
}