我可以通过 node.js 中的 socket.io 将文件上传到服务器吗? [英] Can I upload a file to server by socket.io in node.js?
问题描述
我有一个 socket.io 客户端,socket.io 服务器在 node.js 中监听.我想通过 socket.io
将文件上传到服务器.因为我的 socket.io
客户端在 apache 下.socket.io
服务器在 Node.js 中.我想在 Node.js 中编写文件上传代码.但是我如何将文件数据发送到监听套接字的 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.
我尝试使用 Node.js 服务器上传文件.这个链接在这里,但是这个代码没有使用 socket.io
和这个.但我原来的项目使用的是 socket.io
.
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
.
如何使用 socket.io
服务器执行此操作?
How can I do this with the socket.io
server?
推荐答案
勾选的答案自 2012 年 7 月 3 日起无效.
The checked answer is invalid as of Jul 3rd 2012.
自己阅读这个NetTuts 教程.本教程使用 node.js 和 socket.io 上传文件.
Read by yourself this tutorial on NetTuts. This tutorial uses node.js and socket.io to upload a file.
这篇关于我可以通过 node.js 中的 socket.io 将文件上传到服务器吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!