开发者

upload and send a file

开发者 https://www.devze.com 2023-02-20 08:49 出处:网络
Hey guys, I created this system of instant messaging now i want to upload and send a file to another user.

Hey guys, I created this system of instant messaging now i want to upload and send a file to another user. I am using php and javascript. How to do so? Ok imagine that i am a user chatting for instance with you, now i want to send you a file how can i do it using php. I understand that it is two steps upload the file and then send? Is that开发者_StackOverflow社区 right?


You should have on client A a classic uploader that will upload file to a specific directory for the chat session, then when upload is complete show to client B a message/link in the chat that a file is available for download.
Hey ! You have made a FTP over HTTP ;) Your server will be the exchange platform.


The steps should be:

  1. Bob and Alice are in chat.
  2. Bob click the Browse button and select a file.
  3. The file is uploaded to the server using standard PHP upload script.
  4. The file is being validated, and only if valid continue to next step. (e.g. no executable, maybe virus scan)
  5. The file is saved in secure location outside the website root, with unique ID.
  6. Alice see system message "Bob has sent you a file" with link to PHP proxy file e.g. download.php?id=[the unique ID assigned in previous step]
  7. The file download.php will verify the user requesting it match the recipient of the uploaded file according to the given ID and if matching, send the file to the browser to invoke download.
0

精彩评论

暂无评论...
验证码 换一张
取 消