Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I upload a file to server by socket.io in node.js?

I have a socket.io client to whom socket.io server is listening in node.js. I want to upload a file to server by socket.io. because my socket.io client is under apache. and socket.io server is in Node.js. I want to code uploading of file in Node.js. But how I can send the file data to the node.js listening to socket.

I have tried the upload of a file using Node.js server. This link is here but the this code does not use the socket.io with this. But my original project is using the socket.io.

Uploading a file in node.js by formidable

How can I do this with the socket.io server?

like image 940
XMen Avatar asked May 12 '11 05:05

XMen


People also ask

How do I upload a file to a server?

Right-click the folder and select “Upload other file here. . .“. Browse the server for the file you want to upload. Select the file and click Open. Now, you will see the file in the folder location on the server.

What is the use of Socket.IO in node JS?

Socket.IO enables real-time bidirectional event-based communication. It works on every platform, browser or device, focusing equally on reliability and speed. Socket.IO is built on top of the WebSockets API (Client side) and Node. js.

Does Socket.IO require a server?

It seems that Socket.IO is always dependent on a http server, to the point that it will create one for you, like in the example above.


1 Answers

The checked answer is invalid as of Jul 3rd 2012.

Read by yourself this tutorial on NetTuts. This tutorial uses node.js and socket.io to upload a file.

like image 146
Olivier Refalo Avatar answered Oct 20 '22 18:10

Olivier Refalo