Upload any file

What you’ll learn

By the end of this guide you will learn how to upload a file using oeCloud framework.

What you’ll need

To complete this guide, you will need the following -

  • a running NodeJS application built using the oeCloud framework. You can get this here
  • a working REST client. REST addons for browsers, like RESTClient for Firefox or Advanced REST client for Google Chrome can be used to complete this guide.

How to complete this guide

You can start from scratch and complete each step, or you can continue from a previous project created.

To start from the scratch go to Getting Started

If you already have the application up and running then you can proceed with the following steps.

We will proceed with the assumption that you have access to Advanced REST client of Google Chrome, which would be used as a REST client.

What you will essentially do is select the files to be uploaded and make a POST call to the Document model’s API provided by the oeCloud framework. Document model is automatically created whenever the application starts.

This API is an endpoint hosted by the running oeCloud framework and is of the form:


We would need to create a placeholder called container for the Document model, which will create a placeholder to upload files, using the following post API endpoint,


and send JSON data with only name key, for example

{"name": "containerName"}

After this, the placeholder can be used to upload documents into this container, using following post API endpoint


{container} is a place holder where we need to pass the name we created using previous API.

Open Advanced REST client of chrome, add http://localhost:3000/api/documents/testContainer/upload to request URL. (we have named the container as testContainer.) Choose the files tab and click on the CHOOSE FILES button to add the files you want to upload. You can select multiple files by clicking on ADD ANOTHER FILE After the files are selected then click on SEND button to make a POST call which will upload those selected files.

The request call will look like below : Image

After the POST call to upload a file is completed response will look like below : Image


We have seen how we can upload a file within a oeCloud framework based NodeJS application using the upload api of Document model provided by the framework.