Automate file upload in node.js -


i have written node.js server accept file.

app.post('/', function(req, res) {   console.log(req.files);   fs.readfile(req.files.displayimage.path, function (err, data) {      var newpath = __dirname + "/"+req.files.displayimage.name;     fs.writefile(newpath, data, function (err) {       if (err) throw err;       res.redirect("back");     });   }); }); 

this works perfect html form is

<form action="http://localhost/", method="post", enctype="multipart/form-data">   <input type="file", name="displayimage">   <input type="submit", name="upload"> 

but want remove html ui , want have node.js code automatically consume file. ok have file hard-coded path.

i need node.js script can call server code , send file upload.

any help?


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -