javascript - Image Upload ending prematurely nodejs -


using node.js, decided time work file uploads. looking @ options, felt uploading socketio best bet me. of course brought list of modules down not being able use multer or other ways require load http request. settled socket.io-stream , working great until tried uploading bigger files (200 kb or bigger) not great being average size of stuff uploaded 50 kb 700 kb max of 1mb. seems me upload ending prematurely without clue on why. although feel problem server side, here both client , server.

client:

var file = $("#map").prop('files')[0];         var stream = ss.createstream();         ss(m).emit('file', stream, {name: file.name}); 

server:

   ss(socket).on('file', function(stream, data) {             var filename = path.basename(data.name);             var way = '/images/maps/uploaded/';             stream.pipe(fs.createwritestream('public'+way+filename));             stream.on('end', function() {                 socket.emit('filedone', "<img src='" + way + filename + "' height='200px;' width='400px'/>");             });         });  

as can tell main function upload images. client side works i'm not worried that. on server side, file , save in uploaded directory. stream.on callback show uploaded image after done.

when uploading "big files" (over 200kb) partially works picture below , ones tend bigger 700kb show size 0 after uploading.

example of bad upload

this not perfect solution problem more of work around. using socket.io-steam, had problem switching socketio-file-upload fixed problem. still have no idea on why did not work first way.


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -