我可以通过node.js中的socket.io将文件上传到服务器吗? [英] Can I upload a file to server by socket.io in node.js?

查看:232
本文介绍了我可以通过node.js中的socket.io将文件上传到服务器吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 socket.io客户端 socket.io服务器在node.js中监听。我想通过socket.io上传文件到服务器。因为我的socket.io客户端是在Apache下。而socket.io服务器在node.js中。我想代码上传node.js中的文件。但我怎么能发送文件数据到Node.js监听套接字。

我已经尝试使用node.js服务器上传文件。这个链接在这里,但是这个代码并没有使用这个socket.io。但我原来的项目是使用socket.io。

http://rahulmehta1.wordpress.com/2011/04/26/uploading-a-file-in-node-js-by- / b>

我怎样才能做到这一点与socket.io服务器?

解决



自己读 NetTuts上的这个教程
本教程使用node.js和socket.io上传文件。


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.

http://rahulmehta1.wordpress.com/2011/04/26/uploading-a-file-in-node-js-by-formidable/

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

解决方案

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.

这篇关于我可以通过node.js中的socket.io将文件上传到服务器吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆