How to upload files which are larger than 2 MB

How to upload files which are larger than 2 MB

If you want to upload files using PHP to a server which are larger than 2 MB and there is a limit (e.g. 2 MB) on the server, you can do following steps:

  • See your PHP Info - create file called e.g. info.php and add following php code to this file:
<?php
echo phpinfo();
?>
  • Run this file on your server and you will see all PHP settings
  • See upload_max_filesize directive

It is your server:
  • If there is only 2M (2 MB), you should increase your upload filesize in your php.ini
  • Open your php.ini (linux: /etc/php.ini, windows: C:\WINDOWS or C:\WINNT) and change or add the following piece of code:
;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;

; Maximum allowed size for uploaded files

upload_max_filesize = 4M

  • Save your php.ini and restart your server

It is not your server:

  • Try to add the following code to your index.php file (or your main script file):

<?php
ini_set('upload_max_filesize', '4M');
?>
  • If it doesn't work, you must contact your server support.
 

Please Take The Poll

New Site
 
 
JoomlaMafia has readers from all over the world and in many languages. If you create a translation of one of our posts and link to it than please let us know so we can add a link back to the translation at the original post.