开发者

Is it possible to interrupt file upload in PHP (with APC)?

开发者 https://www.devze.com 2023-04-12 19:36 出处:网络
It is possible to track the upload status in PHP (with APC) andI\'m wonderi开发者_C百科ng if I can cancel the transfer somehow from PHP. Is it possible?Unfortunately, no. The upload is something which

It is possible to track the upload status in PHP (with APC) and I'm wonderi开发者_C百科ng if I can cancel the transfer somehow from PHP. Is it possible?


Unfortunately, no. The upload is something which is triggered and controlled by the client (think about it — it is a part of the POST request). This means that even if the upload is going to a 404, it will still continue to upload until the server returns the response.


Maybe you could use JQuery "chunk" file uploaders, so the upload can be made by chunks (through JQuery) and the server can decide when to stop receiving. You'd have to modify the chunking plugin, I guess, but that shouldn't be too much of an effort.

It still doesn't offer you the possibility to cancel in the middle of a packet, but you could probably chunk in 1% bits and make sure you have plenty of opportunities to tell the JQuery script that you don't want more.

See https://github.com/blueimp/jQuery-File-Upload/wiki/Chunked-file-uploads

0

精彩评论

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

关注公众号