Sha256: b6dc3daa7bee30009041e25395a8be63ed35db7e3428c28a6fe7823e76bb28d3
Contents?: true
Size: 1.78 KB
Versions: 2
Compression:
Stored size: 1.78 KB
Contents
<?php /** * Created by JetBrains PhpStorm. * User: taoqili * Date: 12-7-18 * Time: 上午10:42 */ header("Content-Type: text/html; charset=utf-8"); error_reporting(E_ERROR | E_WARNING); include "Uploader.class.php"; //上传图片框中的描述表单名称, $title = htmlspecialchars($_POST['pictitle'], ENT_QUOTES); $path = htmlspecialchars($_POST['dir'], ENT_QUOTES); //上传配置 $config = array( "savePath" => ($path == "1" ? "upload/" : "upload1/"), "maxSize" => 1000, //单位KB "allowFiles" => array(".gif", ".png", ".jpg", ".jpeg", ".bmp") ); //生成上传实例对象并完成上传 $up = new Uploader("upfile", $config); /** * 得到上传文件所对应的各个参数,数组结构 * array( * "originalName" => "", //原始文件名 * "name" => "", //新文件名 * "url" => "", //返回的地址 * "size" => "", //文件大小 * "type" => "" , //文件类型 * "state" => "" //上传状态,上传成功时必须返回"SUCCESS" * ) */ $info = $up->getFileInfo(); /** * 向浏览器返回数据json数据 * { * 'url' :'a.jpg', //保存后的文件路径 * 'title' :'hello', //文件描述,对图片来说在前端会添加到title属性上 * 'original' :'b.jpg', //原始文件名 * 'state' :'SUCCESS' //上传状态,成功时返回SUCCESS,其他任何值将原样返回至图片上传框中 * } */ echo "{'url':'" . $info["url"] . "','title':'" . $title . "','original':'" . $info["originalName"] . "','state':'" . $info["state"] . "'}";
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ueditor-rails-1.2.5.3 | vendor/assets/javascripts/ueditor/php/imageUp.php |
ueditor-rails-1.2.5.1 | vendor/assets/javascripts/ueditor/php/imageUp.php |