move_uploaded_file -- Moves an uploaded file to a new location
Description
bool move_uploaded_file ( string filename, string destination)
This function checks to ensure that the file designated by filename is a valid upload file (meaning that it was uploaded via PHP's HTTP POST upload mechanism). If the file is valid, it will be moved to the filename given by destination.
If filename is not a valid upload file, then no action will occur, and move_uploaded_file() will return FALSE.
If filename is a valid upload file, but cannot be moved for some reason, no action will occur, and move_uploaded_file() will return FALSE. Additionally, a warning will be issued.
This sort of check is especially important if there is any chance that anything done with uploaded files could reveal their contents to the user, or even to other users on the same system.
Note: When safe mode is enabled, PHP checks whether the file(s)/directories you are about to operate on have the same UID as the script that is being executed.
Note: move_uploaded_file() is not affected by the normal safe-mode UID-restrictions. This is not unsafe because move_uploaded_file() only operates on files uploaded via PHP.
Warning
If the destination file already exists, it will be overwritten.
See also is_uploaded_file(), and the section Handling file uploads for a simple usage example.
如果出现
Fatal error: Maximum execution time of 30 seconds exceeded in e:\server\program\apache\htdocs\update\index.php on line 2
修改php.ini中的
max_execution_time integer
This sets the maximum time in seconds a script is allowed to run before it is terminated by the parser. This helps prevent poorly written scripts from tying up the server. The default setting is 30.
The maximum execution time is not affected by system calls, the sleep() function, etc. Please see the set_time_limit() function for more details.
1.只修改upload_max_filesize = 2M,改为upload_max_filesize = 100M
大于2M的文件能上传了,但是到了某一大小的时候,就不能上传.提示:
Warning: Unable to open '' for reading: Permission denied in e:\server\program\apache\htdocs\update\index.php on line 13
2.经楼上的朋友提示,修改post_max_size = 8M,改为post_max_size = 100M
上传一RM(7xM).
最后提示:
Fatal error: Maximum execution time of 30 seconds exceeded in e:\server\program\apache\htdocs\update\index.php on line 2