Notes for uploading files in PHP: 1. in form, set the method attribute to post, and enctype attribute to multipart/form-data; 2. upload file size limit 1) PHP configuration file (PHP3 is php3.ini, PHP4 is php. in ini), upload_max_filesize is used to limit the maximum size of PHP.
Notes for uploading files in PHP:
1. in form, set the method attribute to post, and enctype attribute to multipart/form-data;
2. restrictions on the size of uploaded files
1) PHP configuration file (PHP3 is php3.ini and PHP4 is php. in ini), upload_max_filesize is used to limit the maximum size of uploaded files that PHP can process. measured in bytes. the default value is 2097152 = 2*1024*1024 bytes (2 MB ), note that you must restart Apache after modifying the file, otherwise it will not take effect;
2) you can add a hidden-type input box named MAX_FILE_SIZE to the form. its value is the maximum number of bytes that can be uploaded by the client, of course, this value cannot exceed the PHP configuration file (PHP3 is php3.ini, and PHP4 is php. ini) in upload_max_filesize. Note that this input box must be placed in front of all file-type input boxes; otherwise, it is invalid;
3. temporary directory for storing uploaded files
The upload_tmp_dir in the PHP configuration file (PHP3 is php3.ini and PHP4 is php. ini) is used to set
Upload a temporary directory for storing files. Note that the account running Apache must have the read and write permissions on this directory,
At the same time, you must restart Apache after the modification, otherwise it will not take effect;
4. after the PHP program runs, the system automatically deletes the temporary files uploaded to the server, therefore, if you want to process uploaded files (such as copying files to another directory or putting the file content in the database), you must do so in this PHP program.