{"id":22137,"date":"2020-08-10T15:16:01","date_gmt":"2020-08-10T15:16:01","guid":{"rendered":"http:\/\/node_js_file_upload_to_a_local_server_or_to_the_cloud"},"modified":"2024-06-04T15:59:47","modified_gmt":"2024-06-04T22:59:47","slug":"node_js_file_upload_to_a_local_server_or_to_the_cloud","status":"publish","type":"post","link":"https:\/\/cloudinary.com\/blog\/node_js_file_upload_to_a_local_server_or_to_the_cloud","title":{"rendered":"Node.js File Upload to a Local Server Or to the Cloud"},"content":{"rendered":"<div class=\"wp-block-cloudinary-markdown \"><p>Probably one of the best things to happen to JavaScript developers, Node.js empowers them to write and ship JavaScript on the back end. Thanks to Node.js, front-end developers can become full-stack developers in a snap.<\/p>\n<p>The procedures below describe how to Node.js <a href=\"https:\/\/cloudinary.com\/blog\/automating_file_upload_and_sharing\">file upload\u2019s<\/a> to your local server or to the cloud at Cloudinary.<\/p>\n<h2>Set Up a Node Project<\/h2>\n<p>First, <a href=\"https:\/\/nodejs.org\/en\/download\/\">download and install Node.js on your system<\/a>. Afterwards, set up a Node.js back-end server with a package, such as Express. Do the following:<\/p>\n<ol>\n<li>\n<p>Create an <code>upload<\/code> directory and run <code>npm init<\/code> there to generate a <code>package.json<\/code> file:<\/p>\n<pre class=\"js-syntax-highlighted\"><span><code class=\"hljs shcb-wrap-lines\">npm init\n<\/code><\/span><\/pre>\n<\/li>\n<li>\n<p>In the same directory, install Express:<\/p>\n<pre class=\"js-syntax-highlighted\"><span><code class=\"hljs shcb-wrap-lines\">npm install express --save\n<\/code><\/span><\/pre>\n<\/li>\n<li>\n<p>Create an <code>index.js<\/code> file with the code below:<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript shcb-wrap-lines\">    <span class=\"hljs-keyword\">const<\/span> express = <span class=\"hljs-built_in\">require<\/span>(<span class=\"hljs-string\">'express'<\/span>)\n    <span class=\"hljs-keyword\">const<\/span> app = express()\n    <span class=\"hljs-keyword\">const<\/span> port = <span class=\"hljs-number\">3000<\/span>\n\n    app.get(<span class=\"hljs-string\">'\/'<\/span>, (req, res) =&gt; res.json({ <span class=\"hljs-attr\">message<\/span>: <span class=\"hljs-string\">'Hello World!'<\/span> }))\n\n    app.listen(port, () =&gt; <span class=\"hljs-built_in\">console<\/span>.log(<span class=\"hljs-string\">`This is the beginning of the Node File Upload App`<\/span>))\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<\/li>\n<li>\n<p>Run the project with the command <code>node index.js<\/code>.<\/p>\n<p>Your back-end server is now up and running.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/image\/upload\/w_700,c_fill,f_auto,q_auto,dpr_2.0\/Web_Assets\/blog\/local_host-upload.png\" alt=\"upload\" loading=\"lazy\" class=\"c-transformed-asset\"  width=\"1400\" height=\"349\"\/><\/p>\n<p>Afterwards, <code>multer<\/code> creates an <code>images<\/code> directory in which to display the details of the recently uploaded file in your console. See this example:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/image\/upload\/w_700,c_fill,f_auto,q_auto,dpr_2.0\/Web_Assets\/blog\/node_upload.png\" alt=\"node upload\" loading=\"lazy\" class=\"c-transformed-asset\"  width=\"1400\" height=\"1038\"\/><\/p>\n<p>For simultaneous multiple file uploads, just change <code>fileUpload.single<\/code> to <code>fileUpload.array<\/code>:<\/p>\n<\/li>\n<\/ol>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript shcb-wrap-lines\">...\napp.post(<span class=\"hljs-string\">'\/photos\/upload'<\/span>, fileUpload.array(<span class=\"hljs-string\">'image'<\/span>, <span class=\"hljs-number\">5<\/span>), <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> (<span class=\"hljs-params\">req, res, next<\/span>) <\/span>{\n      <span class=\"hljs-built_in\">console<\/span>.log(<span class=\"hljs-string\">\"Images \"<\/span>, req.file);  \n})\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p><code>5<\/code> above can be any numeric value, denoting the number of files you plan to upload.<\/p>\n<h3>Step 2: Set up file uploads to Cloudinary<\/h3>\n<p>Completing step 1 enables you to upload files to your local <a href=\"https:\/\/cloudinary.com\/glossary\/origin-servers\">server<\/a>. For multiple files, best store them in a central location like Cloudinary and behind a content delivery network (CDN) at scale for efficient retrieval and delivery to users.<\/p>\n<p>This step establishes the mechanics for uploading files to Cloudinary.<\/p>\n<p>As a prerequisite, <a href=\"https:\/\/cloudinary.com\/users\/register_free\">sign up for a free account on Cloudinary<\/a>. Note your cloud name and API keys on the dashboard.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/image\/upload\/w_700,c_fill,f_auto,q_auto,dpr_2.0\/Web_Assets\/blog\/media_library.png\" alt=\"media library\" loading=\"lazy\" class=\"c-transformed-asset\"  width=\"1400\" height=\"899\"\/><\/p>\n<p>Now do the following.<\/p>\n<ol>\n<li>\n<p>Rewrite <code>multer<\/code> to accept zero arguments:<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript shcb-wrap-lines\"><span class=\"hljs-keyword\">const<\/span> fileUpload = multer()\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<p>Instead of being written to a local directory, the uploaded files now reside in memory temporarily as a buffer.<\/p>\n<\/li>\n<li>\n<p>Install <a href=\"https:\/\/cloudinary.com\/documentation\/node_integration\">Cloudinary\u2019s Node.js SDK<\/a> and the <code>streamifier<\/code> library:<\/p>\n<pre class=\"js-syntax-highlighted\"><span><code class=\"hljs shcb-wrap-lines\">npm install cloudinary \nnpm install streamifier\n<\/code><\/span><\/pre>\n<\/li>\n<li>\n<p>Make the <code>cloudinary<\/code> and <code>streamifier<\/code> required libraries in your codebase:<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php shcb-wrap-lines\">...\n<span class=\"hljs-keyword\">const<\/span> cloudinary = <span class=\"hljs-keyword\">require<\/span>(<span class=\"hljs-string\">'cloudinary'<\/span>).v2\n<span class=\"hljs-keyword\">const<\/span> streamifier = <span class=\"hljs-keyword\">require<\/span>(<span class=\"hljs-string\">'streamifier'<\/span>)\n...\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<\/li>\n<li>\n<p>Rewrite the <code>\/upload<\/code> endpoint code to upload files to Cloudinary:<\/p>\n<pre class=\"js-syntax-highlighted\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript shcb-wrap-lines\">app.post(<span class=\"hljs-string\">'\/upload'<\/span>, fileUpload.single(<span class=\"hljs-string\">'image'<\/span>), <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> (<span class=\"hljs-params\">req, res, next<\/span>) <\/span>{\n    <span class=\"hljs-keyword\">let<\/span> streamUpload = <span class=\"hljs-function\">(<span class=\"hljs-params\">req<\/span>) =&gt;<\/span> {\n        <span class=\"hljs-keyword\">return<\/span> <span class=\"hljs-keyword\">new<\/span> <span class=\"hljs-built_in\">Promise<\/span>(<span class=\"hljs-function\">(<span class=\"hljs-params\">resolve, reject<\/span>) =&gt;<\/span> {\n            <span class=\"hljs-keyword\">let<\/span> stream = cloudinary.uploader.upload_stream(\n              <span class=\"hljs-function\">(<span class=\"hljs-params\">error, result<\/span>) =&gt;<\/span> {\n                <span class=\"hljs-keyword\">if<\/span> (result) {\n                  resolve(result);\n                } <span class=\"hljs-keyword\">else<\/span> {\n                  reject(error);\n                }\n              }\n            );\n\n          streamifier.createReadStream(req.file.buffer).pipe(stream);\n        });\n    };\n\n    <span class=\"hljs-keyword\">async<\/span> <span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">upload<\/span>(<span class=\"hljs-params\">req<\/span>) <\/span>{\n        <span class=\"hljs-keyword\">let<\/span> result = <span class=\"hljs-keyword\">await<\/span> streamUpload(req);\n        <span class=\"hljs-built_in\">console<\/span>.log(result);\n    }\n\n    upload(req);\n});\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n<\/li>\n<\/ol>\n<p>Recall that you rewrote <code>multer<\/code> earlier to process and store uploaded files temporarily as a buffer. <code>streamifier<\/code> now converts the uploaded buffer to a readable stream, after which Cloudinary\u2019s <code>upload_stream<\/code> method streams directly to the cloud.<\/p>\n<p>The returned result looks like this, complete with the details on the recently uploaded file:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/image\/upload\/w_700,c_fill,f_auto,q_auto,dpr_2.0\/Web_Assets\/blog\/node_index.png\" alt=\"node.js index\" loading=\"lazy\" class=\"c-transformed-asset\"  width=\"1400\" height=\"1038\"\/><\/p>\n<p>Now you can fetch the URL from the JSON response and store it in the database. Mission accomplished.<\/p>\n<h2>A Word About Cloudinary\u2019s Node.js SDK<\/h2>\n<p>Besides uploading images and videos, Cloudinary\u2019s Node.js SDK can also transform, optimizatize, and deliver them. You can seamlessly integrate those capabilities with your Node.js app. For details, see the <a href=\"https:\/\/cloudinary.com\/documentation\/node_integration\">related documentation<\/a>.<\/p>\n<h2>Want to Learn More About File Uploads?<\/h2>\n<ul>\n<li>\n<a href=\"https:\/\/cloudinary.com\/blog\/automating_file_upload_and_sharing\">Automating File Upload and Sharing<\/a>\n<\/li>\n<li>\n<a href=\"https:\/\/cloudinary.com\/blog\/file_upload_with_php\">Uploading PHP Files and Rich Media the Easy Way<\/a>\n<\/li>\n<li>\n<a href=\"https:\/\/cloudinary.com\/blog\/file_upload_with_ajax\">AJAX File Upload &#8211; Quick Tutorial &amp; Time Saving Tips<\/a>\n<\/li>\n<li>\n<a href=\"https:\/\/cloudinary.com\/blog\/impressed_by_whatsapp_technology_build_a_whatsapp_clone_with_image_and_video_upload\">Impressed by WhatsApp technology? Clone WhatsApp Technology to Build a File Upload Android App<\/a>\n<\/li>\n<li>\n<a href=\"https:\/\/cloudinary.com\/blog\/direct_image_uploads_from_the_browser_to_the_cloud_with_jquery\">Direct Image Uploads From the Browser to the Cloud With jQuery<\/a>\n<\/li>\n<li>\n<a href=\"https:\/\/cloudinary.com\/blog\/file_upload_with_angular_or_angularjs_to_cloudinary\">File Upload With Angular to Cloudinary<\/a>\n<\/li>\n<li>\n<a href=\"https:\/\/cloudinary.com\/blog\/uploading_vue_files_and_rich_media_in_two_easy_steps\">Uploading Vue Files and Rich Media in Two Easy Steps<\/a>\n<\/li>\n<li>\n<a href=\"https:\/\/cloudinary.com\/blog\/node_js_file_upload_to_a_local_server_or_to_the_cloud\">Node.js File Upload To a Local Server Or to the Cloud<\/a>\n<\/li>\n<li>\n<a href=\"https:\/\/cloudinary.com\/blog\/laravel_file_upload_to_a_local_server_or_to_the_cloud\">Laravel File Upload to a Local Server Or to the Cloud<\/a>\n<\/li>\n<li>\n<a href=\"https:\/\/cloudinary.com\/blog\/javascript_file_upload_to_cloudinary\">JavaScript File Upload in Two Simple Step<\/a>\n<\/li>\n<\/ul>\n<\/div>","protected":false},"excerpt":{"rendered":"","protected":false},"author":41,"featured_media":22138,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_cloudinary_featured_overwrite":false,"footnotes":""},"categories":[1],"tags":[25,119,214,303],"class_list":["post-22137","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-asset-management","tag-file-upload","tag-node","tag-video"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.6 (Yoast SEO v26.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Node.js File Upload to a Local Server Or to the Cloud<\/title>\n<meta name=\"description\" content=\"Learn how to upload Node.js files to a local server or, through Cloudinary\u2019s Node.js SDK, to the cloud at Cloudinary.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/cloudinary.com\/blog\/node_js_file_upload_to_a_local_server_or_to_the_cloud\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Node.js File Upload to a Local Server Or to the Cloud\" \/>\n<meta property=\"og:description\" content=\"Learn how to upload Node.js files to a local server or, through Cloudinary\u2019s Node.js SDK, to the cloud at Cloudinary.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cloudinary.com\/blog\/node_js_file_upload_to_a_local_server_or_to_the_cloud\" \/>\n<meta property=\"og:site_name\" content=\"Cloudinary Blog\" \/>\n<meta property=\"article:published_time\" content=\"2020-08-10T15:16:01+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-06-04T22:59:47+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/v1649718358\/Web_Assets\/blog\/Node-JS-File-Upload_22138e92f8\/Node-JS-File-Upload_22138e92f8-png?_i=AA\" \/>\n\t<meta property=\"og:image:width\" content=\"1540\" \/>\n\t<meta property=\"og:image:height\" content=\"847\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"NewsArticle\",\"@id\":\"https:\/\/cloudinary.com\/blog\/node_js_file_upload_to_a_local_server_or_to_the_cloud#article\",\"isPartOf\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/node_js_file_upload_to_a_local_server_or_to_the_cloud\"},\"author\":{\"name\":\"\",\"@id\":\"\"},\"headline\":\"Node.js File Upload to a Local Server Or to the Cloud\",\"datePublished\":\"2020-08-10T15:16:01+00:00\",\"dateModified\":\"2024-06-04T22:59:47+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/node_js_file_upload_to_a_local_server_or_to_the_cloud\"},\"wordCount\":12,\"publisher\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/node_js_file_upload_to_a_local_server_or_to_the_cloud#primaryimage\"},\"thumbnailUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718358\/Web_Assets\/blog\/Node-JS-File-Upload_22138e92f8\/Node-JS-File-Upload_22138e92f8.png?_i=AA\",\"keywords\":[\"Asset Management\",\"File-upload\",\"Node\",\"Video\"],\"inLanguage\":\"en-US\",\"copyrightYear\":\"2020\",\"copyrightHolder\":{\"@id\":\"https:\/\/cloudinary.com\/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/cloudinary.com\/blog\/node_js_file_upload_to_a_local_server_or_to_the_cloud\",\"url\":\"https:\/\/cloudinary.com\/blog\/node_js_file_upload_to_a_local_server_or_to_the_cloud\",\"name\":\"Node.js File Upload to a Local Server Or to the Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/node_js_file_upload_to_a_local_server_or_to_the_cloud#primaryimage\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/node_js_file_upload_to_a_local_server_or_to_the_cloud#primaryimage\"},\"thumbnailUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718358\/Web_Assets\/blog\/Node-JS-File-Upload_22138e92f8\/Node-JS-File-Upload_22138e92f8.png?_i=AA\",\"datePublished\":\"2020-08-10T15:16:01+00:00\",\"dateModified\":\"2024-06-04T22:59:47+00:00\",\"description\":\"Learn how to upload Node.js files to a local server or, through Cloudinary\u2019s Node.js SDK, to the cloud at Cloudinary.\",\"breadcrumb\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/node_js_file_upload_to_a_local_server_or_to_the_cloud#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/cloudinary.com\/blog\/node_js_file_upload_to_a_local_server_or_to_the_cloud\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudinary.com\/blog\/node_js_file_upload_to_a_local_server_or_to_the_cloud#primaryimage\",\"url\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718358\/Web_Assets\/blog\/Node-JS-File-Upload_22138e92f8\/Node-JS-File-Upload_22138e92f8.png?_i=AA\",\"contentUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718358\/Web_Assets\/blog\/Node-JS-File-Upload_22138e92f8\/Node-JS-File-Upload_22138e92f8.png?_i=AA\",\"width\":1540,\"height\":847},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/cloudinary.com\/blog\/node_js_file_upload_to_a_local_server_or_to_the_cloud#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/cloudinary.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Node.js File Upload to a Local Server Or to the Cloud\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#website\",\"url\":\"https:\/\/cloudinary.com\/blog\/\",\"name\":\"Cloudinary Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/cloudinary.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#organization\",\"name\":\"Cloudinary Blog\",\"url\":\"https:\/\/cloudinary.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA\",\"contentUrl\":\"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA\",\"width\":312,\"height\":60,\"caption\":\"Cloudinary Blog\"},\"image\":{\"@id\":\"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Node.js File Upload to a Local Server Or to the Cloud","description":"Learn how to upload Node.js files to a local server or, through Cloudinary\u2019s Node.js SDK, to the cloud at Cloudinary.","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:\/\/cloudinary.com\/blog\/node_js_file_upload_to_a_local_server_or_to_the_cloud","og_locale":"en_US","og_type":"article","og_title":"Node.js File Upload to a Local Server Or to the Cloud","og_description":"Learn how to upload Node.js files to a local server or, through Cloudinary\u2019s Node.js SDK, to the cloud at Cloudinary.","og_url":"https:\/\/cloudinary.com\/blog\/node_js_file_upload_to_a_local_server_or_to_the_cloud","og_site_name":"Cloudinary Blog","article_published_time":"2020-08-10T15:16:01+00:00","article_modified_time":"2024-06-04T22:59:47+00:00","og_image":[{"width":1540,"height":847,"url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/v1649718358\/Web_Assets\/blog\/Node-JS-File-Upload_22138e92f8\/Node-JS-File-Upload_22138e92f8-png?_i=AA","type":"image\/png"}],"twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/cloudinary.com\/blog\/node_js_file_upload_to_a_local_server_or_to_the_cloud#article","isPartOf":{"@id":"https:\/\/cloudinary.com\/blog\/node_js_file_upload_to_a_local_server_or_to_the_cloud"},"author":{"name":"","@id":""},"headline":"Node.js File Upload to a Local Server Or to the Cloud","datePublished":"2020-08-10T15:16:01+00:00","dateModified":"2024-06-04T22:59:47+00:00","mainEntityOfPage":{"@id":"https:\/\/cloudinary.com\/blog\/node_js_file_upload_to_a_local_server_or_to_the_cloud"},"wordCount":12,"publisher":{"@id":"https:\/\/cloudinary.com\/blog\/#organization"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/node_js_file_upload_to_a_local_server_or_to_the_cloud#primaryimage"},"thumbnailUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718358\/Web_Assets\/blog\/Node-JS-File-Upload_22138e92f8\/Node-JS-File-Upload_22138e92f8.png?_i=AA","keywords":["Asset Management","File-upload","Node","Video"],"inLanguage":"en-US","copyrightYear":"2020","copyrightHolder":{"@id":"https:\/\/cloudinary.com\/#organization"}},{"@type":"WebPage","@id":"https:\/\/cloudinary.com\/blog\/node_js_file_upload_to_a_local_server_or_to_the_cloud","url":"https:\/\/cloudinary.com\/blog\/node_js_file_upload_to_a_local_server_or_to_the_cloud","name":"Node.js File Upload to a Local Server Or to the Cloud","isPartOf":{"@id":"https:\/\/cloudinary.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/cloudinary.com\/blog\/node_js_file_upload_to_a_local_server_or_to_the_cloud#primaryimage"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/node_js_file_upload_to_a_local_server_or_to_the_cloud#primaryimage"},"thumbnailUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718358\/Web_Assets\/blog\/Node-JS-File-Upload_22138e92f8\/Node-JS-File-Upload_22138e92f8.png?_i=AA","datePublished":"2020-08-10T15:16:01+00:00","dateModified":"2024-06-04T22:59:47+00:00","description":"Learn how to upload Node.js files to a local server or, through Cloudinary\u2019s Node.js SDK, to the cloud at Cloudinary.","breadcrumb":{"@id":"https:\/\/cloudinary.com\/blog\/node_js_file_upload_to_a_local_server_or_to_the_cloud#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cloudinary.com\/blog\/node_js_file_upload_to_a_local_server_or_to_the_cloud"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudinary.com\/blog\/node_js_file_upload_to_a_local_server_or_to_the_cloud#primaryimage","url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718358\/Web_Assets\/blog\/Node-JS-File-Upload_22138e92f8\/Node-JS-File-Upload_22138e92f8.png?_i=AA","contentUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718358\/Web_Assets\/blog\/Node-JS-File-Upload_22138e92f8\/Node-JS-File-Upload_22138e92f8.png?_i=AA","width":1540,"height":847},{"@type":"BreadcrumbList","@id":"https:\/\/cloudinary.com\/blog\/node_js_file_upload_to_a_local_server_or_to_the_cloud#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cloudinary.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Node.js File Upload to a Local Server Or to the Cloud"}]},{"@type":"WebSite","@id":"https:\/\/cloudinary.com\/blog\/#website","url":"https:\/\/cloudinary.com\/blog\/","name":"Cloudinary Blog","description":"","publisher":{"@id":"https:\/\/cloudinary.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/cloudinary.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/cloudinary.com\/blog\/#organization","name":"Cloudinary Blog","url":"https:\/\/cloudinary.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA","contentUrl":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718331\/Web_Assets\/blog\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877\/cloudinary_logo_for_white_bg_1937437aa7_19374666c7_193742f877.png?_i=AA","width":312,"height":60,"caption":"Cloudinary Blog"},"image":{"@id":"https:\/\/cloudinary.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":""}]}},"jetpack_featured_media_url":"https:\/\/res.cloudinary.com\/cloudinary-marketing\/images\/f_auto,q_auto\/v1649718358\/Web_Assets\/blog\/Node-JS-File-Upload_22138e92f8\/Node-JS-File-Upload_22138e92f8.png?_i=AA","_links":{"self":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/22137","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/comments?post=22137"}],"version-history":[{"count":5,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/22137\/revisions"}],"predecessor-version":[{"id":34377,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/posts\/22137\/revisions\/34377"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/media\/22138"}],"wp:attachment":[{"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/media?parent=22137"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/categories?post=22137"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudinary.com\/blog\/wp-json\/wp\/v2\/tags?post=22137"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}