max file size in php

You can increase the maximum file size for uploads in PHP by modifying the upload_max_filesize and post_max_size directives in your php.ini file. These values limit the maximum size of a single uploaded file and the maximum amount of data that can be sent in a POST request, respectively.

Here's an example of how you can set the maximum file size to 10MB in your php.ini file:

; Maximum allowed size for uploaded files.
upload_max_filesize = 10M

; Must be greater than or equal to upload_max_filesize.
post_max_size = 10M
146 chars
6 lines

If you don't have access to the php.ini file, you can also modify these values in your PHP script using the ini_set function:

main.php
// Set maximum file size to 10MB
ini_set('upload_max_filesize', '10M');
ini_set('post_max_size', '10M');
105 chars
4 lines

Keep in mind that increasing the maximum file size can have consequences on your server's performance and security, so make sure to test your application thoroughly and handle file uploads carefully to avoid any issues.

gistlibby LogSnag