Upload Images to Server and Let user preview selected Image.
1 min readDec 14, 2017
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
- User can choose an image file.
- User can preview the image before uploading.
- User can upload chosen file.
- 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');