Home >Web Front-end >JS Tutorial >nodejs integrates kindEditor to implement image upload_node.js
The kindEditor official website provides integrated applications related to ASP, ASP.NET, and JSP. http://kindeditor.net/docs/upload.html can refer to the integration of nodejs and find that it is easier to use nodejs
Environment:
unbuntu 14.10
nodejs 0.10.35
express 4.11.2
formidable 1.0.16
kindEditor 4.1.10
webStorm 8
1. Create a project named test through IDE or terminal
2. Edit package.json to add formidable dependencies. The 1.0.16 version is used here, and then execute npm install through the terminal to complete the installation of dependencies
3. Place the entire kindEditor directory under test/public/lib
4. Modify index.ejs and index.js files
Integrate kindEditor in index.ejs:
Set the uploadJson of kindEditor to the routing url provided by nodejs for processing image uploads. The /uploadImg
is used here.
Add the routing url to handle image uploads in index.js:
Add the post processing method corresponding to /uploadImg,
The code is as follows:
index.js
http://localhost:3000 to upload images