javascript - "Error: socket hang up" while streaming using multiparty and request modules -


here code:

var app = require("express")(); var multiparty = require("multiparty"); var request = require("request"); var ims = require("imagemagick-stream"); var fs = require("fs"); var busboy = require('busboy');  app.post('/submit', function(httprequest, httpresponse, next){      var form = new multiparty.form();      form.on("part", function(part){         if(part.filename)         {             var formdata = {                 thumbnail: {                     value:  part,                     options: {                         filename: part.filename,                         contenttype: part["content-type"]                     }                 }             };              request.post({url:'http://localhost:7070/store', formdata: formdata}, function (err, httpresponse, body) {                 if(err) {                     return console.error('upload failed:', err);                 }                  console.log('upload successful!  server responded with:');             });         }     })      form.on("error", function(error){         console.log(error);     })      form.parse(httprequest);      });  app.get('/', function(httprequest, httpresponse, next){      httpresponse.send('<form action="http://localhost:9090/submit" method="post" enctype="multipart/form-data"><input type="file" name="file" /><input type="submit" value="xxx" /></form>'); });  app.listen(9090); 

here uploading file submitted user server without saving on disk.

i error upload failed: { [error: socket hang up] code: 'econnreset' }.

and on server running on port 7070 error error: stream ended unexpectedly

if replace part in value:part filesystem readable stream works fine.

i think missing content-length header. when add different error.

thanks in advance.


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -