Example from http://hidrodixtion.github.io/2016/06/02/create-simple-image-upload-server-in-node-js/
- Install node & npm
- optional: install coffeescript.
npm install -g coffee-script
- Install express.
npm install express
- Install multer.
npm install multer
- Run the server.
- coffeescript :
coffee Multipart_File.coffee
- node/javascript :
node Multipart_File.js
- Install httpie
- Run httpie command
http -f POST 127.0.0.1:3000 name='upload_test' upload@path_to_file_name.jpg
- change
path_to_file_name.jpg
with your image full path.
Above command should print this log in server console :
{ fieldname: 'upload',
originalname: 'filename.jpg',
encoding: '7bit',
mimetype: 'text/plain',
destination: './uploads',
filename: '10b84dc968b78e83da635cbbe416f6e1.jpg',
path: 'uploads/10b84dc968b78e83da635cbbe416f6e1.jpg',
size: 19242 }
{ name: 'upload_test' }