本文整理汇总了PHP中FileUploader::uploadFile方法的典型用法代码示例。如果您正苦于以下问题:PHP FileUploader::uploadFile方法的具体用法?PHP FileUploader::uploadFile怎么用?PHP FileUploader::uploadFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileUploader
的用法示例。
在下文中一共展示了FileUploader::uploadFile方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: FileUploader
function upload_file()
{
$name = $_FILES['file']['name'];
$file = $_FILES['file'];
$fileUploader = new FileUploader($file, $name);
$json = $fileUploader->uploadFile();
echo $json;
}
示例2: isset
<?php
include "includes.php";
$id = $_POST['id'];
$filePath = $_POST['filePath'];
$name = isset($_POST['name']) ? $_POST['name'] : null;
$description = isset($_POST['description']) ? $_POST['description'] : null;
$preview = $_POST['preview'];
$thumb = $_POST['thumb'];
$downloads = $_POST['downloads'];
$path;
if (!$id) {
$file = $_FILES['upload'];
$fileUploader = new FileUploader($file, $name, $description);
$id = $fileUploader->uploadFile();
} else {
$file = new File($filePath, $name, $description, $downloads, $preview, $thumb, $id);
$file->update();
header("Location: /admin/files/" . $id);
exit;
}
示例3: function
<?php
$this->respond(['GET', 'POST'], '/uploadFile', function ($request, $response, $service, $app) {
$ans = FileUploader::uploadFile();
if ($ans != -1) {
$response->json(Result::success('file uploaded.', ['path' => $ans]));
} else {
$response->json(Result::error('file upload Failed.'));
}
});
示例4: uploadFileForUser
public function uploadFileForUser($file, $id)
{
$user = $this->userDao->get($id);
ResultHelper::whenEmpty($user, AppLabelUtil::$ERROR_USER_NOT_FOUND, HttpStatusCode::badRequest());
$fileUploader = new FileUploader();
$newFileName = $fileUploader->uploadFile($file["file"]["name"], $file["file"]["tmp_name"], WEB . "/assets/user/" . $user->getUsername() . "/cv/");
$user->setFile($newFileName);
return $this->userDao->update($user);
}
示例5: actionSaveShemaObject
/**
* Save shema object. All params must be passed vie POST method.
*/
public function actionSaveShemaObject()
{
if (!isset($_POST['shema'])) {
die('Invalid shema');
}
//TODO
$attr = $_POST;
$type = $attr['shema'];
if (FileUploader::hasFile('xfile')) {
$attr['text_value'] = FileUploader::uploadFile('xfile');
}
$object = DataModelFactory::createDataObjectWithType($type);
$object->setAttributes($attr);
$storage = DataStorageFactory::createDataStorageWithType($type);
$storage->save($object);
$this->redirect(Yii::app()->createUrl('manager/shema', array('shema' => $type)));
}
示例6: FileUploader
<?php
include "../../../wp-load.php";
$name = $_FILES['file']['name'];
$file = $_FILES['file'];
$fileUploader = new FileUploader($file, $name);
$json = $fileUploader->uploadFile();
echo $json;