百度编辑器(ueditor)图片上传流程

2025-05-09 17:50:46

通过审查元素可以查看到百度图编辑的图片上传的html如下:

百度编辑器(ueditor)图片上传流程

<form

id="edui_form_hx77vh46"

target="edui_iframe_hx77vh46"

method="POST"

enctype="multipart/form-data"

action="http://mengkang.net/ueditor/php/controller.php?action=uploadimage" >

<input

id="edui_input_hx77vh46"

type="file"

accept="image/*"

name="upfile" >

</form>

<iframe id="edui_iframe_hx77vh46" name="edui_iframe_hx77vh46" style="display:none;"></iframe>

实际就是通过一个`iframe`来代理表单上传图片,处理图片的控制器服务器端代码是`ueditor/php/controller.php`

在`controller.php`里面首先读取了上传路径的配置文件`ueditor/php/config.json`

$CONFIG = json_decode(preg_replace("/\/\*[\s\S]+?\*\//", "", file_get_contents("config.json")), true);

百度编辑器(ueditor)图片上传流程

因为有了这个配置文件,所以上传路径还是可以非常方便的自定义的。

然后根据$_GET['action']来判断包含哪个文件,最后配合配置路径和ueditor/php/Uploader.class.php就实现了图片的上传,具体代码查看ueditor/php整个目录

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢