开发者

Php upload and bandwidth/traffic question

I have set upload limit to 3M in php.ini. If someone uploads a file that is 50 mb, t开发者_C百科hen does the upload stop when it hits 3Mb or does it continue until the upload is complete, then reads the filesize and deletes the file?


If you're using Apache as your web server, then PHP doesn't get a chance to start until the request completes. Thus, the upload limit only comes into action after the whole upload finishes. Apache first receives the entire request, and only then does it invoke the appropriate handler (in this case, PHP). Since there is no server-side mechanism to abort a HTTP request in progress and return a response, you'll need to wait until the whole request is complete.

So, to answer your question: NO, the upload will go through in full; PHP's internal logic will check the uploaded file size, see that it's larger than the limit, and then fail immediately with an error. Your PHP script will not get a chance to run, so don't rely on runtime checks - they won't be executed at all.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜