dongzanghong4379 2011-03-02 12:41
浏览 17

在仍然使用PHP上传时处理POST输入

I'm trying to run some code while data is still being uploaded. Is it possible with Apache+PHP?

Basically, I'm trying to read from php://input before client->server upload completes. The upload itself may take several hours and I'd like to do some logging while it's working. I don't mind reading from a blocking file descriptor.

Cheers

  • 写回答

1条回答 默认 最新

  • douhanzhuo6905 2011-03-02 12:52
    关注

    No, your script does not take control until the upload has completed. The APC stuff mentioned in a comment above is limited to PHP writing out upload status to a file elsewhere on the system, which can then be read by another script to send out as progress information.

    But while an upload is going, you cannot do anything with that connection until the upload completes or is aborted.

    PHP is also badly suited for very large uploads - consider what happens if your link were to hiccup 10bytes from the end of that very long/large upload. Since PHP is not in control of the upload, there's no way to resume. FTP/SFTP are better suited for such things, especially since they won't delete an aborted upload.

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度