{"id":6480,"date":"2024-03-14T04:19:09","date_gmt":"2024-03-14T04:19:09","guid":{"rendered":"https:\/\/www.silicloud.com\/blog\/how-to-implement-image-uploading-function-in-kindeditor-using-node-js\/"},"modified":"2025-08-02T04:10:24","modified_gmt":"2025-08-02T04:10:24","slug":"how-to-implement-image-uploading-function-in-kindeditor-using-node-js","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/blog\/how-to-implement-image-uploading-function-in-kindeditor-using-node-js\/","title":{"rendered":"KindEditor Image Upload with Node.js Tutorial"},"content":{"rendered":"<p>To implement KindEditor&#8217;s image uploading function in node.js, you can follow these steps:<\/p>\n<ol>\n<li>Install the Express framework and the Multer module.<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code>npm install express multer\r\n<\/code><\/pre>\n<ol>\n<li>Create a route file (such as upload.js) in the project for uploading images and add the following code to it.<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><span class=\"hljs-keyword\">const<\/span> express = <span class=\"hljs-built_in\">require<\/span>(<span class=\"hljs-string\">'express'<\/span>);\r\n<span class=\"hljs-keyword\">const<\/span> multer = <span class=\"hljs-built_in\">require<\/span>(<span class=\"hljs-string\">'multer'<\/span>);\r\n<span class=\"hljs-keyword\">const<\/span> router = express.<span class=\"hljs-title class_\">Router<\/span>();\r\n\r\n<span class=\"hljs-keyword\">const<\/span> storage = multer.<span class=\"hljs-title function_\">diskStorage<\/span>({\r\n  <span class=\"hljs-attr\">destination<\/span>: <span class=\"hljs-keyword\">function<\/span> (<span class=\"hljs-params\">req, file, cb<\/span>) {\r\n    <span class=\"hljs-title function_\">cb<\/span>(<span class=\"hljs-literal\">null<\/span>, <span class=\"hljs-string\">'uploads\/'<\/span>)  <span class=\"hljs-comment\">\/\/ \u6307\u5b9a\u56fe\u7247\u4e0a\u4f20\u7684\u76ee\u5f55<\/span>\r\n  },\r\n  <span class=\"hljs-attr\">filename<\/span>: <span class=\"hljs-keyword\">function<\/span> (<span class=\"hljs-params\">req, file, cb<\/span>) {\r\n    <span class=\"hljs-title function_\">cb<\/span>(<span class=\"hljs-literal\">null<\/span>, file.<span class=\"hljs-property\">originalname<\/span>)  <span class=\"hljs-comment\">\/\/ \u4f7f\u7528\u539f\u59cb\u6587\u4ef6\u540d\u4f5c\u4e3a\u4e0a\u4f20\u540e\u7684\u6587\u4ef6\u540d<\/span>\r\n  }\r\n})\r\n\r\n<span class=\"hljs-keyword\">const<\/span> upload = <span class=\"hljs-title function_\">multer<\/span>({ <span class=\"hljs-attr\">storage<\/span>: storage });\r\n\r\nrouter.<span class=\"hljs-title function_\">post<\/span>(<span class=\"hljs-string\">'\/upload'<\/span>, upload.<span class=\"hljs-title function_\">single<\/span>(<span class=\"hljs-string\">'file'<\/span>), <span class=\"hljs-function\">(<span class=\"hljs-params\">req, res<\/span>) =&gt;<\/span> {\r\n  <span class=\"hljs-keyword\">const<\/span> file = req.<span class=\"hljs-property\">file<\/span>;\r\n  res.<span class=\"hljs-title function_\">json<\/span>({\r\n    <span class=\"hljs-attr\">url<\/span>: <span class=\"hljs-string\">`\/uploads\/<span class=\"hljs-subst\">${file.filename}<\/span>`<\/span>\r\n  });\r\n});\r\n\r\n<span class=\"hljs-variable language_\">module<\/span>.<span class=\"hljs-property\">exports<\/span> = router;\r\n<\/code><\/pre>\n<ol>\n<li>Include and use the route file in the main file (such as app.js).<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><span class=\"hljs-keyword\">const<\/span> express = <span class=\"hljs-built_in\">require<\/span>(<span class=\"hljs-string\">'express'<\/span>);\r\n<span class=\"hljs-keyword\">const<\/span> app = <span class=\"hljs-title function_\">express<\/span>();\r\n<span class=\"hljs-keyword\">const<\/span> uploadRouter = <span class=\"hljs-built_in\">require<\/span>(<span class=\"hljs-string\">'.\/routes\/upload'<\/span>);\r\n\r\napp.<span class=\"hljs-title function_\">use<\/span>(<span class=\"hljs-string\">'\/api'<\/span>, uploadRouter);\r\n\r\napp.<span class=\"hljs-title function_\">listen<\/span>(<span class=\"hljs-number\">3000<\/span>, <span class=\"hljs-function\">() =&gt;<\/span> {\r\n  <span class=\"hljs-variable language_\">console<\/span>.<span class=\"hljs-title function_\">log<\/span>(<span class=\"hljs-string\">'Server is running on port 3000'<\/span>);\r\n});\r\n<\/code><\/pre>\n<ol>\n<li>In the front-end page, use KindEditor to upload images and save them to the directory specified in the above route (uploads\/). Then, return the URL of the uploaded image to KindEditor for display.<\/li>\n<\/ol>\n<p>The above are the basic steps to implement the image upload function of KindEditor using node.js. You can make appropriate modifications and extensions according to your specific needs.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To implement KindEditor&#8217;s image uploading function in node.js, you can follow these steps: Install the Express framework and the Multer module. npm install express multer Create a route file (such as upload.js) in the project for uploading images and add the following code to it. const express = require(&#8216;express&#8217;); const multer = require(&#8216;multer&#8217;); const router [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","footnotes":""},"categories":[1],"tags":[7868,7867,7866,7869,1796],"class_list":["post-6480","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-express-framework","tag-image-upload","tag-kindeditor","tag-multer","tag-node-js"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>KindEditor Image Upload with Node.js Tutorial - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"Learn how to implement image uploading in KindEditor using Node.js, Express, and Multer. Step-by-step tutorial with code examples.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/blog\/how-to-implement-image-uploading-function-in-kindeditor-using-node-js\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"KindEditor Image Upload with Node.js Tutorial\" \/>\n<meta property=\"og:description\" content=\"Learn how to implement image uploading in KindEditor using Node.js, Express, and Multer. Step-by-step tutorial with code examples.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/blog\/how-to-implement-image-uploading-function-in-kindeditor-using-node-js\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/SiliCloudGlobal\/\" \/>\n<meta property=\"article:published_time\" content=\"2024-03-14T04:19:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-02T04:10:24+00:00\" \/>\n<meta name=\"author\" content=\"Ava Mitchell\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@SiliCloudGlobal\" \/>\n<meta name=\"twitter:site\" content=\"@SiliCloudGlobal\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ava Mitchell\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/how-to-implement-image-uploading-function-in-kindeditor-using-node-js\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/how-to-implement-image-uploading-function-in-kindeditor-using-node-js\/\"},\"author\":{\"name\":\"Ava Mitchell\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/a3e2658c2cb9fb2be95ae0a8861f4a64\"},\"headline\":\"KindEditor Image Upload with Node.js Tutorial\",\"datePublished\":\"2024-03-14T04:19:09+00:00\",\"dateModified\":\"2025-08-02T04:10:24+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/how-to-implement-image-uploading-function-in-kindeditor-using-node-js\/\"},\"wordCount\":127,\"publisher\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/#organization\"},\"keywords\":[\"Express framework\",\"Image upload\",\"KindEditor\",\"Multer\",\"Node.js\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/how-to-implement-image-uploading-function-in-kindeditor-using-node-js\/\",\"url\":\"https:\/\/www.silicloud.com\/blog\/how-to-implement-image-uploading-function-in-kindeditor-using-node-js\/\",\"name\":\"KindEditor Image Upload with Node.js Tutorial - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/#website\"},\"datePublished\":\"2024-03-14T04:19:09+00:00\",\"dateModified\":\"2025-08-02T04:10:24+00:00\",\"description\":\"Learn how to implement image uploading in KindEditor using Node.js, Express, and Multer. Step-by-step tutorial with code examples.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/how-to-implement-image-uploading-function-in-kindeditor-using-node-js\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/blog\/how-to-implement-image-uploading-function-in-kindeditor-using-node-js\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/how-to-implement-image-uploading-function-in-kindeditor-using-node-js\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.silicloud.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"KindEditor Image Upload with Node.js Tutorial\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/blog\/\",\"name\":\"Silicon Cloud Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/#organization\"},\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#organization\",\"name\":\"Silicon Cloud Blog\",\"url\":\"https:\/\/www.silicloud.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.silicloud.com\/blog\/wp-content\/uploads\/2023\/11\/EN-SILICON-Full.png\",\"contentUrl\":\"https:\/\/www.silicloud.com\/blog\/wp-content\/uploads\/2023\/11\/EN-SILICON-Full.png\",\"width\":1024,\"height\":1024,\"caption\":\"Silicon Cloud Blog\"},\"image\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/SiliCloudGlobal\/\",\"https:\/\/twitter.com\/SiliCloudGlobal\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/a3e2658c2cb9fb2be95ae0a8861f4a64\",\"name\":\"Ava Mitchell\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/15c63cd0564b4a2e07d611bcdffa296f6ea80e8db07c3091f43a84010514899d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/15c63cd0564b4a2e07d611bcdffa296f6ea80e8db07c3091f43a84010514899d?s=96&d=mm&r=g\",\"caption\":\"Ava Mitchell\"},\"url\":\"https:\/\/www.silicloud.com\/blog\/author\/avamitchell\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"KindEditor Image Upload with Node.js Tutorial - Blog - Silicon Cloud","description":"Learn how to implement image uploading in KindEditor using Node.js, Express, and Multer. Step-by-step tutorial with code examples.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/blog\/how-to-implement-image-uploading-function-in-kindeditor-using-node-js\/","og_locale":"en_US","og_type":"article","og_title":"KindEditor Image Upload with Node.js Tutorial","og_description":"Learn how to implement image uploading in KindEditor using Node.js, Express, and Multer. Step-by-step tutorial with code examples.","og_url":"https:\/\/www.silicloud.com\/blog\/how-to-implement-image-uploading-function-in-kindeditor-using-node-js\/","og_site_name":"Blog - Silicon Cloud","article_publisher":"https:\/\/www.facebook.com\/SiliCloudGlobal\/","article_published_time":"2024-03-14T04:19:09+00:00","article_modified_time":"2025-08-02T04:10:24+00:00","author":"Ava Mitchell","twitter_card":"summary_large_image","twitter_creator":"@SiliCloudGlobal","twitter_site":"@SiliCloudGlobal","twitter_misc":{"Written by":"Ava Mitchell","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.silicloud.com\/blog\/how-to-implement-image-uploading-function-in-kindeditor-using-node-js\/#article","isPartOf":{"@id":"https:\/\/www.silicloud.com\/blog\/how-to-implement-image-uploading-function-in-kindeditor-using-node-js\/"},"author":{"name":"Ava Mitchell","@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/a3e2658c2cb9fb2be95ae0a8861f4a64"},"headline":"KindEditor Image Upload with Node.js Tutorial","datePublished":"2024-03-14T04:19:09+00:00","dateModified":"2025-08-02T04:10:24+00:00","mainEntityOfPage":{"@id":"https:\/\/www.silicloud.com\/blog\/how-to-implement-image-uploading-function-in-kindeditor-using-node-js\/"},"wordCount":127,"publisher":{"@id":"https:\/\/www.silicloud.com\/blog\/#organization"},"keywords":["Express framework","Image upload","KindEditor","Multer","Node.js"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/blog\/how-to-implement-image-uploading-function-in-kindeditor-using-node-js\/","url":"https:\/\/www.silicloud.com\/blog\/how-to-implement-image-uploading-function-in-kindeditor-using-node-js\/","name":"KindEditor Image Upload with Node.js Tutorial - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/blog\/#website"},"datePublished":"2024-03-14T04:19:09+00:00","dateModified":"2025-08-02T04:10:24+00:00","description":"Learn how to implement image uploading in KindEditor using Node.js, Express, and Multer. Step-by-step tutorial with code examples.","breadcrumb":{"@id":"https:\/\/www.silicloud.com\/blog\/how-to-implement-image-uploading-function-in-kindeditor-using-node-js\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/blog\/how-to-implement-image-uploading-function-in-kindeditor-using-node-js\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/blog\/how-to-implement-image-uploading-function-in-kindeditor-using-node-js\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.silicloud.com\/blog\/"},{"@type":"ListItem","position":2,"name":"KindEditor Image Upload with Node.js Tutorial"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/blog\/#website","url":"https:\/\/www.silicloud.com\/blog\/","name":"Silicon Cloud Blog","description":"","publisher":{"@id":"https:\/\/www.silicloud.com\/blog\/#organization"},"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.silicloud.com\/blog\/#organization","name":"Silicon Cloud Blog","url":"https:\/\/www.silicloud.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.silicloud.com\/blog\/wp-content\/uploads\/2023\/11\/EN-SILICON-Full.png","contentUrl":"https:\/\/www.silicloud.com\/blog\/wp-content\/uploads\/2023\/11\/EN-SILICON-Full.png","width":1024,"height":1024,"caption":"Silicon Cloud Blog"},"image":{"@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/SiliCloudGlobal\/","https:\/\/twitter.com\/SiliCloudGlobal"]},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/a3e2658c2cb9fb2be95ae0a8861f4a64","name":"Ava Mitchell","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/15c63cd0564b4a2e07d611bcdffa296f6ea80e8db07c3091f43a84010514899d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/15c63cd0564b4a2e07d611bcdffa296f6ea80e8db07c3091f43a84010514899d?s=96&d=mm&r=g","caption":"Ava Mitchell"},"url":"https:\/\/www.silicloud.com\/blog\/author\/avamitchell\/"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/posts\/6480","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/comments?post=6480"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/posts\/6480\/revisions"}],"predecessor-version":[{"id":151241,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/posts\/6480\/revisions\/151241"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/media?parent=6480"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/categories?post=6480"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/tags?post=6480"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}