简体   繁体   English

使用PHP jQuery发送和接收文件

[英]sending and receiving files with PHP jQuery

How can I send and receive files live like in yahoo chat? 如何像Yahoo聊天一样实时发送和接收文件? ie if I send the file than the user on the other end will only get that file if he click on the accept button and if he click deny than the file should not upload and should be deleted from the server... I want to do that via PHP jQuery $.ajax() . 即,如果我发送文件,则另一端的用户仅在他单击接受按钮并且如果他单击拒绝时才得到该文件,则该文件不应上传并且应从服务器中删除...我想通过PHP jQuery $.ajax()

This is a rather complicated question, and not easily addressed. 这是一个相当复杂的问题,不易解决。 Here are a couple things: 以下是几件事:

  1. You'll want a way to identify conversations. 您将需要一种识别对话的方法。 You wouldn't want your file-request getting intercepted by a completely different set of people. 您不希望您的文件请求被一组完全不同的人员拦截。
  2. You'll probably want to invoke some form of long-polling that will send a request to the server, who in turn will send a request (link) to the other user, who, when clicks the link, the server will return the first request back to you, initializing your upload. 您可能需要调用某种形式的长轮询,该长轮询将向服务器发送请求,后者又将向另一个用户发送请求(链接),当用户单击链接时,服务器将返回第一个请求。请求返回给您,初始化您的上传。
  3. You can use the jQuery Plugin Uploadify for the asynchronous uploads, and late-initialization from a server-response. 您可以使用jQuery插件Uploadify进行异步上传,并通过服务器响应进行后期初始化。
  4. You may also want to keep a database table to list all of the file shared by any particular conversation. 您可能还需要保留一个数据库表以列出任何特定对话共享的所有文件。 This would be queries to find out if new files need to be listed in the users windows. 这将是查询以确定是否需要在用户窗口中列出新文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM