本文整理汇总了PHP中UploadFile::getInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP UploadFile::getInfo方法的具体用法?PHP UploadFile::getInfo怎么用?PHP UploadFile::getInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UploadFile
的用法示例。
在下文中一共展示了UploadFile::getInfo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upload_head
public function upload_head()
{
$upfile_path = Tiny::getPath("uploads") . "/head/";
$upfile_url = preg_replace("|" . APP_URL . "|", '', Tiny::getPath("uploads_url") . "head/", 1);
//$upfile_url = strtr(Tiny::getPath("uploads_url")."head/",APP_URL,'');
$upfile = new UploadFile('imgFile', $upfile_path, '500k', '', 'hash', $this->user['id']);
$upfile->save();
$info = $upfile->getInfo();
$result = array();
if ($info[0]['status'] == 1) {
$result = array('error' => 0, 'url' => $upfile_url . $info[0]['path']);
$image_url = $upfile_url . $info[0]['path'];
$image = new Image();
$image->suffix = '';
$image->thumb(APP_ROOT . $image_url, 100, 100);
$model = new Model('user');
$model->data(array('head_pic' => $image_url))->where("id=" . $this->user['id'])->update();
$safebox = Safebox::getInstance();
$user = $this->user;
$user['head_pic'] = $image_url;
$safebox->set('user', $user);
} else {
$result = array('error' => 1, 'message' => $info[0]['msg']);
}
echo JSON::encode($result);
}
示例2: array
function photoshop_upload()
{
$file = $_FILES['upfile'];
if ($file['error'] == 4) {
$msg = array('error', '请选择文件后再上传!');
$this->redirect("photoshop", true, array('msg' => $msg));
} else {
if ($file['error'] == 1) {
$msg = array('error', '文件超出了php.ini文件指定大小!');
$this->redirect("photoshop", true, array('msg' => $msg));
} else {
if ($file['size'] > 0) {
$key = md5_file($file['tmp_name']);
$gallery = new Model('gallery');
$img = $gallery->where("`key`='" . $key . "'")->find();
echo JS::import('dialog?skin=brief');
echo JS::import('dialogtools');
if (!$img) {
$upfile_path = Tiny::getPath("uploads");
$upfile_url = preg_replace("|^" . APP_URL . "|", '', Tiny::getPath("uploads_url"));
$upfile = new UploadFile('upfile', $upfile_path, '10m');
$upfile->save();
$info = $upfile->getInfo();
$result = array();
if ($info[0]['status'] == 1) {
$url = $upfile_url . $info[0]['path'];
$key = md5_file($upfile_path . $info[0]['path']);
$type = Req::args("type") == null ? 0 : intval(Req::args('type'));
$gallery->data(array('key' => $key, 'type' => $type, 'img' => $url))->save();
echo "<script>art.dialog.opener.setImg('{$url}');</script>";
} else {
$msg = array('error', $info[0]['msg']);
$this->msg = $msg;
$this->redirect("photoshop", false);
}
} else {
$url = $img['img'];
echo "<script>art.dialog.opener.setImg('{$url}');</script>";
}
}
}
}
exit;
}
示例3: img_upload
public function img_upload()
{
$path = APP_ROOT;
$upf = new UploadFile('imgFile', $path, '2m', 'jpg,jpeg,gif');
$upf->save();
$info = $upf->getInfo();
if ($info[0]['status'] == 1) {
echo JSON::encode(array('error' => 0, 'url' => $info[0]['path']));
exit;
}
}