本文整理汇总了PHP中Uploader::initSimple方法的典型用法代码示例。如果您正苦于以下问题:PHP Uploader::initSimple方法的具体用法?PHP Uploader::initSimple怎么用?PHP Uploader::initSimple使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Uploader
的用法示例。
在下文中一共展示了Uploader::initSimple方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
}
}
示例2: 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)));
}
}
}
示例3: 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);
}
}
}