Home » Programming » php » PHP File Upload

PHP File Upload

File upload is a very important topic in PHP. Build any kind of websites or web application there has must be files. So want know that how can upload files or retrieve those files and download it (if required).



Always use form method post for uploading the file, and enctype is mandatory, otherwise, the file doesn’t upload.
Before uploading the file need to set some options. By default uploaded file size is set 2M. So sometimes file doesn’t upload if the file size is large than 2M.
That’s why set upload_max_filesize= 500M or any large value in the php.ini file (xampp/php/php.ini).
And also modify the post_max_size value in the php.ini file. By default post_max_size is 8M. Sometimes for this reason also file doesn’t upload if the size is large then 8M instead of upload_max_size is greater than 8M.
So also set post_max_size=500M or any large value in the php.ini file (xampp/php/php.ini).
Any changes in the php.ini file need to restart xampp control panel. Stop apache and start again. Then the updated value will be reflected.

Managed by MochaHost - Fast & Easy WordPress Hosting