sending and receiving files with PHP jQuery
How can I send and receive files live like in yahoo chat? i.e 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 开发者_JAVA技巧from the server... I want to do that via PHP jQuery $.ajax()
.
This is a rather complicated question, and not easily addressed. Here are a couple things:
- You'll want a way to identify conversations. You wouldn't want your file-request getting intercepted by a completely different set of people.
- 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.
- You can use the jQuery Plugin Uploadify for the asynchronous uploads, and late-initialization from a server-response.
- 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.
精彩评论