本文整理汇总了PHP中Uploader::getError方法的典型用法代码示例。如果您正苦于以下问题:PHP Uploader::getError方法的具体用法?PHP Uploader::getError怎么用?PHP Uploader::getError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Uploader
的用法示例。
在下文中一共展示了Uploader::getError方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upload
public function upload()
{
if (isset($_FILES)) {
$project = $_POST['project'];
$parentDirCrypted = $_POST['parent'];
$facade = new SystemFacade($project);
$parent = $facade->decrypt($parentDirCrypted);
for ($i = 0; $i < count($_FILES['file']['name']); $i++) {
$fileName = $_FILES['file']['name'][$i];
$fileTmp = $_FILES['file']['tmp_name'][$i];
$fileType = $_FILES['file']['type'][$i];
$fileSize = $_FILES['file']['size'][$i];
$fileError = $_FILES['file']['error'][$i];
$uploader = new Uploader($fileName, $fileType, $fileTmp, $fileSize, $fileError);
if ($uploader->uploadFile()) {
$facade->manageFileName($fileName, $parent);
if ($facade->createObject($parent, $uploader->getFileName(), $uploader->getRealType(), $uploader->getFileType(), $uploader->getUploadedSource())) {
$facade->refreshDirectoryDate($parent);
} else {
echo "Couldn't save file to database.";
}
} else {
echo $uploader->getError();
}
}
echo $facade->makeFileList();
}
}
示例2: run
public function run()
{
$uploader = new Uploader();
if (Yii::app()->request->isPostRequest) {
//普通上传
$uploader->initSimple('album')->uploadSimple('simple_file');
$error = $uploader->getError();
if (!$error) {
$data = array('file_name' => $uploader->file_name, 'file_path' => $uploader->file_path, 'file_path_full' => Helper::getFullUrl($uploader->file_path), 'thumb_path' => $uploader->thumb_path, 'thumb_path_full' => Helper::getFullUrl($uploader->thumb_path), 'file_ext' => $uploader->file_ext);
App::response(200, 'success', $data);
} else {
App::response(101, $error);
}
}
}
示例3: actionUpload
/**
* 文件上传
*/
public function actionUpload()
{
$uploader = new Uploader();
if (Yii::app()->request->isPostRequest) {
//断点上传
$uploader->initSimple('kindeditor')->uploadSimple('kindeditor_file');
$error = $uploader->getError();
if (!$error) {
//返回kindeditor接收的json格式
exit(CJSON::encode(array('error' => 0, 'url' => Helper::getFullUrl($uploader->file_path))));
} else {
exit(CJSON::encode(array('error' => 0, 'message' => $error)));
}
}
}
示例4: run
public function run()
{
$uploader = new Uploader();
if (Yii::app()->request->isPostRequest) {
//开始剪切
$image = $_POST['file'];
$uploader->initSimple('avatar');
$cut_image = $uploader->imageCut($image, array('cut_w' => 100, 'cut_h' => 100, 'pos_x' => $_POST['x'], 'pos_y' => $_POST['y']));
$error = $uploader->getError();
if (!$error) {
$data = array('cut_avatar' => $cut_image);
App::response(200, '裁剪成功', $data);
} else {
App::response(101, $error);
}
}
}
示例5: run
public function run()
{
$uploader = new Uploader();
if (Yii::app()->request->isPostRequest) {
//断点上传
$uploader->initResumable('album')->uploadResumable('file');
$error = $uploader->getError();
if (!$error) {
$data = array('file_name' => $uploader->file_name, 'file_path' => $uploader->file_path, 'file_path_full' => Helper::getFullUrl($uploader->file_path), 'file_ext' => $uploader->file_ext);
App::response(200, 'success', $data);
} else {
App::response(101, $error);
}
} else {
//校验已上传的片段
$uploader->checkExistChunks();
}
}
示例6: SearchGateway
return new SearchGateway($app->mysqli);
});
$app->get('/', function () use($app) {
$flash = isset($_SESSION['slim.flash']) ? $_SESSION['slim.flash'] : null;
$app->render('frontpage.phtml', array("flash" => $flash, "title" => "Download.me - файлообменник", "maxFileSize" => $app->config('maxFileSize'), 'active' => 'home'));
});
$app->post('/upload(/:async)', function ($async = false) use($app) {
$uploader = new Uploader($app->config('uploadDir'), $app->FileGateway);
$id = $uploader->uploadFile($_FILES);
if ($id && !$async) {
$app->response->redirect("/f/{$id}", 303);
} elseif ($id && $async) {
header("Content-Type: application/json");
echo json_encode(array('id' => $id));
} elseif (!$id && !$async) {
$app->flash('error', $uploader->getError());
$app->response->redirect('/', 303);
}
});
$app->get('/upload-progress', function () use($app) {
$uploader = new Uploader($app->config('uploadDir'), $app->FileGateway);
$data = $uploader->getUploadProgress();
if ($data) {
$data['ok'] = true;
header("Content-Type: application/json");
echo json_encode($data);
} else {
$data = array("ok" => false);
header("Content-Type: application/json");
echo json_encode($data);
}
示例7: SystemFacade
<?php
$_GRUNT_PATH = 1;
require_once '../GruntFileSystem.php';
if (isset($_FILES)) {
$project = $_POST['project'];
$parentDirCrypted = $_POST['parent'];
$facade = new SystemFacade($project);
$parent = $facade->decrypt($parentDirCrypted);
for ($i = 0; $i < count($_FILES['file']['name']); $i++) {
$fileName = $_FILES['file']['name'][$i];
$fileTmp = $_FILES['file']['tmp_name'][$i];
$fileType = $_FILES['file']['type'][$i];
$fileSize = $_FILES['file']['size'][$i];
$fileError = $_FILES['file']['error'][$i];
$uploader = new Uploader($fileName, $fileType, $fileTmp, $fileSize, $fileError);
if ($uploader->uploadFile()) {
$facade->manageFileName($fileName, $parent);
if ($facade->createObject($parent, $uploader->getFileName(), $uploader->getRealType(), $uploader->getFileType(), $uploader->getUploadedSource())) {
$facade->refreshDirectoryDate($parent);
} else {
echo "Couldn't save file to database.";
}
} else {
echo $uploader->getError();
}
}
echo $facade->makeFileList();
}