I have set file filed with 25MB Maximum upload size. But when i upload more then 25mb file it is uploading. How to stop this.Can we create any custom module for file size.

  • Check server max upload size (max_file_uploads). – Rupesh May 15 '14 at 7:11
  • put phpinfo(); in some where and check how much is your server max upload – Yuseferi May 15 '14 at 7:12
  • can we set it by file_validate_size in custom module? – Fawwad May 15 '14 at 7:14
  • Only if your server supports it, that is when your field's allowed file size is lower than server's upload_max_filesize and post_max_size, as @Rupesh already told you (with slight error in parameter's name). – Mołot May 15 '14 at 7:19
  • 1
    Using setting.php OR .htaccess you can achieve this : In setting.php : ini_set('upload_max_filesize', '8M'); OR In **.htaccess file : ** php_value upload_max_filesize 8M and php_value upload_max_filesize 8M check this link – inizio May 15 '14 at 7:27

In Drupal 7 you can achieve by using .htaccess

  • In your .htaccess file:

    • php_value post_max_size 8M
    • php_value upload_max_filesize 8M

    Check this link for more information

| improve this answer | |
  • Custom file validate function will not allow larger files if PHP will not permit uploading them in thee first place, so only your second paragraph is valid. – Mołot May 15 '14 at 8:42
  • @Mołot I have updated my answer, thanks for clarification :) – inizio May 15 '14 at 10:08
  • As of PHP5.3 the first method here (settings.php) is no longer valid. In fact, it's never been valid. post_max_size and upload_max_filesize have never been able to be overridden by ini_set() – Clive Jun 30 '14 at 11:42
  • @Clive I have updated my answer, thanks for clarification :) – inizio Jul 1 '14 at 7:06

Below module helps admin or user with similar admin privileges to change file upload limit on a website without changing php.ini file & restarting the server.


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.