problem description
Today, ueditor is used as a rich text editor. In the background, node-express, refers to the case of https://github.com/netpi/ueditor. When returned, req.ueditor prints the result as undefined.
ueditor1.4.3.3let ueditor = require("ueditor")1.2.3ueditorindex.jsbusboy.on()
related codes
/ / Please paste the code text below (do not replace the code with pictures)
my code:
let ueditor = require("ueditor")
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
// /upload https://github.com/netpi/ueditor/blob/master/example/public/ueditor/ueditor.config.js
// serverUrl: URL + "php/controller.php"
// serverUrl: URL + "ue"
app.use("/static/ueditor/ue", ueditor(path.join(__dirname, "../public/upload"), function(req, res, next) {
// upload
console.log("ueditor",req.ueditor)
if(req.query.action === "uploadimage"){
//
var foo = req.ueditor;
console.log(foo.filename); // exp.png
console.log(foo.encoding); // 7bit
console.log(foo.mimetype); // image/png
// path.join(__dirname, "../public/upload")
var img_url ="/img/";
res.ue_up(img_url); // ueditor
}else if (req.query.action === "listimage"){//
var dir_url = "/img/"; //
res.ue_list(dir_url) // dir_url
}else {//
res.setHeader("Content-Type", "application/json");
// ueditor.config.json
// let configPath = path.join(__dirname, "../static/ueditor/") + "ueditor.config.json";
// console.log("configPath",configPath)
res.redirect("/ueditor/ueditor.config.json");
}})
);