How to set file uploading size limit

Forums: 

I am Setting up H5P on my WordPress Website

I want to set upload a maximum of 2mb image only,

as I want to save uploading storage and time,

how can I set upload size limit, where to change

thank you.

 

Gv

Content types: 
otacke's picture

Hi gvsoft!

You can limit the file upload size in the PHP configuration of your server (max_upload_size). There's no H5P specific option.

Best,

Oliver 

Thank you otacke,

can u suggest me "Which File I need to edit if want to set File Size Limit?"

I can't find the exact code location to set the file size limit, if it is found then we can change the code to set siz limit for uploading, I have done this in my other projects in javascript (jQuery).

regards,

Gv

 

otacke's picture

Hi!

I can't give you the exact location of the PHP configuration file (usually php.ini), because it may vary depending on your webserver, but I can give you https://www.google.com/search?q=PHP+configuration+max_upload_size

Best,
Oliver

It will be useful if added in H5P Configuration,

but there may be a chance to limit it through the uploading dialogue code, but I am unable to find the correct file,

I just want to know Which File I need to edit if want to set Uploading File Size Limit?

thank you

 

BV52's picture

Hi gvsoft,

I think this page may help.

-BV

Thank you BV,

actually, I am using the same method as you suggested, 

changed php.ini  settings in cPanel 

and modified "h5peditor-file.class.php" for showing an error message for uploading a large file.

as shown below, but I want to do this in the file selection dialogue box itself,

anyhow thank you,

regards,

Gv

    if (!$image) {
          $this->result->error = $this->interface->t('Only 200KB jpg,jpeg,png,gif file is Allowed');
          return FALSE;
        }

This page shows how to set in WordPress. How about Moodle. Is it same to " Create or Edit an existing PHP.INI file"?

BV52's picture

HI timberjia,

Moodle should be "simpler", you can check this documentation for the instructions.

-BV