网站首页 美食营养 游戏数码 手工爱好 生活家居 健康养生 运动户外 职场理财 情感交际 母婴教育 时尚美容

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

时间:2024-10-12 13:22:16

通过审查元素可以查看到百度图编辑的图片上传的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整个目录

© 2025 小知经验
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com