In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "precautions for php file upload", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let Xiaobian take you to learn "precautions for uploading php files"!
This article mainly describes the knowledge points related to the configuration uploaded by php files. The configuration of PHP file upload function mainly involves upload_tmp_dir, upload_max_filesize, post_max_size and other options in php.ini configuration file, which are explained one by one below.
Open the php.ini configuration file and find File Uploads
file_uploads = On
HTTP file uploads are allowed by default. This option cannot be set OFF.
upload_tmp_dir =
Default is empty, this option is easy to forget when manually configuring PHP runtime environment, if you do not configure this option, file upload function can not be realized, this option is set to the temporary directory where files are stored when uploading files, you must assign this option, such as upload_tmp_dir ='/leapsoulcn', which means that there is a leapsoulcn directory under the C disk directory, and session configuration, if you are in linux environment, you must grant this directory writable permissions.
How to upload files larger than 8 MB?
Uploading large files mainly involves configuring upload_max_filesize and post_max_size options.
The default file upload size in the php.ini configuration file is 2M. A common mistake for php beginners is to set the maximum file upload size in the form area when writing the file upload function, i.e., the maximum allowed file upload size. Max_file_size (hidden range) values specify the file upload size. In fact, others can bypass this value, so for safety reasons, it is best to configure the upload_max_filesize option in the php.ini configuration file to set the file upload size.
The default upload_max_filesize = 2 MB, that is, the file upload size is 2 MB. If you want to upload files larger than 8 MB, such as 20 MB, you must set upload_max_filesize = 20 MB.
However, just setting upload_max_filesize = 20 MB still can't achieve the upload function of large files. You must modify the post_max_size option in the php.ini configuration file, which represents the maximum byte length of data allowed for POST. The default is 8 MB. If POST data exceeds the limit,$_POST and $_FILES will be empty. To upload large files, you must set this option to a value greater than the upload_max_filesize command. I usually set upload_max_filesize to equal post_max_size. Also, if memory limit is enabled, this value should be less than the value of the memory_limit option.
Other considerations for file uploads
When uploading large files, you will feel slow upload speed, when more than a certain time, will report script execution more than 30 seconds error, this is because in the php.ini configuration file max_execution_time configuration option is at fault, which means that each script maximum allowable execution time (seconds), 0 means no limit. You can adjust the max_execution_time value appropriately, but it is not recommended to set it to 0.
At this point, I believe that everyone on the "php file upload precautions" have a deeper understanding, may wish to actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.