Upload Images to Server and Let user preview selected Image.

Daniel Jordan Osborn
1 min readDec 14, 2017
Screen Shot Of Screen Shots I Uploaded

For this project, I am making a small express.js app that lets a user select a file from their computer, preview that image, upload it and then view all uploaded images.

I am using node’s built in file system method readdir to pass back the list of files in the image folder. When the page loads the client.js makes an ajax request for the list of file names, I pass them to new image element the append them to the document.

Goals

  1. User can choose an image file.
  2. User can preview the image before uploading.
  3. User can upload chosen file.
  4. User can view all images that have been uploaded.

Tools

express var express = require('express');

fs var fs = require('fs);

formidable var formidable = require('formidable');

The full project can be found at my github here.

--

--

Daniel Jordan Osborn

I can't find anything, all I do is look and look. By the time I found that one thing, that other thing I was holding, it's lost... :wq