(1) Put the Ueditor folder into the public directory
(2) Add method Upload () in NewsAction.class.php
Public function upload () {
Import (' ORG.Net.UploadFile ');
$config = Array (
' MaxSize ' + 2000000,//upload the maximum value of the file (2000000 means 2M)
' Supportmulti ' = true,//Whether multiple file uploads are supported
' allowexts ' = = Array (' jpg ', ' png ', ' gif '),//allow uploading of file suffixes to be left blank without suffix checking
' autosub ' = = true,//enable subdirectory save file
' Subtype ' = ' date ',//subdirectory creation can be made using hash datecustom
' DateFormat ' = ' Ymd ',
' Savepath ' = './public/images/school/',//upload file save path
);
$upload = new UploadFile ($config);
if ($upload->upload ()) {
$info = $upload->getuploadfileinfo ();
Echo Json_encode (
Array
' url ' = = $info [0][' Savename '],
' title ' =>htmlspecialchars ($_post[' Pictitle '), ent_quotes),
' Original ' = $info [0][' name '],
' state ' = ' SUCCESS '
)
);
} else {
echo Json_encode (Array (
' state ' = $upload->geterrormsg ()
));
}
}
(3) in the template to be applied (e.g. addnews.html), add the
<scripttype= "Text/javascript" src= ' __public__/ueditor/ueditor.all.min.js ' ></script>
<script type= "Text/javascript" src= ' __public__/ueditor/ueditor.config.js ' ></script>
<script type= "Text/javascript" >
Window. Ueditor_home_url= ' __public__/ueditor ';
window.onload= function () {
Window. Ueditor_config.imageurl= "{: U (' upload ', ' ', ')}"; Method of Access
Window. Ueditor_config.imagepath= ' __public__/uploads/upimgs/'; Image upload saved Path
Ue.geteditor (' Content ');
}
</script>
(4) Change the ID in the label to be displayed (e.g. <textarea> in news content) to (ue.geteditor (' content ');) "content"
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Use of the Ueditor editor