PHP uses apc to implement upload progress bar method_PHP tutorial
WBOYOriginal
2016-07-20 11:11:53925browse
PHP itself does not have the function of having a real-time upload progress bar. If we want to have this function, we usually use ajax to implement it, but PHP provides an apc, which can be configured with PHP to implement the upload progress bar.
Mainly targeted at applications on windows. 1. The server must support the apc extension. If there is no such extension, search php_apc.dll on Baidu and download an extension. The extension requires php.5.2 or above. 2. Configure apc related configuration and restart apache
Explanation: As for the size of the parameters, it depends on the project needs apc.max_file_size, set the upload file supported by apc Size, requires apc.max_file_size <=upload_max_filesize and apc.max_file_size <=post_max_size. Restart apache to achieve apc support.3. Use phpinfo(); in the code to check whether the apc extension is installed.
set_time_limit(600); <🎜>if($_SERVER['REQUEST_METHOD ']=='POST') { <🎜> move_uploaded_file($_FILES["test_file"]["tmp_name"], <🎜> dirname($_SERVER['SCRIPT_FILENAME'])."/UploadTemp/" . $_FILES[ "test_file"]["name"]);//The UploadTemp folder is located in the same directory as this script <🎜> echo "
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn