简体   繁体   English

文件上传问题

[英]file upload issue

There are 2 variables in PHP that affects file upload (specially when their is file is too large) PHP中有2个影响文件上传的变量(特别是当is文件太大时)

1. max_input_time
2. max_execution_time 

Now I want to know whether max_execution_time is calculated after file upload is done, or it is counted with it? 现在,我想知道文件上传完成后是否计算max_execution_time或将其计算在内?

EDIT: I have one file that is around 25+ MB, now my script execution time will be calculated after file is uploaded to temp directory, or it is considered with the upload process? 编辑:我有一个大约25+ MB的文件,现在我的脚本执行时间将在文件上传到temp目录后计算,或者在上传过程中考虑?

max_execution_time does not include the time it takes you to upload a file to the server. max_execution_time不包括您将文件上传到服务器所花费的时间。 It starts running when PHP starts executing (after file uploads). 当PHP开始执行后(文件上传后),它开始运行。

You can easily test this for yourself using a dash of PHP and FireBug. 您可以使用一些PHP和FireBug轻松地自己进行测试。 Add this to your code: 将此添加到您的代码:

var_dump(getrusage());

This will show you the resources used by the PHP script. 这将向您显示PHP脚本使用的资源。 The ru_utime.tv_sec and ru_utime.tv_usec elements tell you how many seconds and microseconds of execution time have been used so far. ru_utime.tv_secru_utime.tv_usec元素告诉您到目前为止已使用了几秒钟和几微秒的执行时间。 So, upload a reasonably large file to your script. 因此,将相当大的文件上传到脚本中。 Then compare ru_utime.tv_sec with the times from the Net panel in firebug. 然后将ru_utime.tv_sec与firebug中“网络”面板中的时间进行比较。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM