I am trying to upload a zip file from Setting Page. I have designed a setting page and in that I have a file upload functionality. I am using setting API to do this.

My issue is: I know that maximum upload size is 8MB by default. When I am trying to upload file less that 8MB, it is working fine. But when any file more that 8MB is uploaded, I am redirected to option.php page.

I just want to handle this type of issue but I am unable to. I have used upload_size_limit filter to increase the upload size but still not working. Upload size increased but unable to Upload file size more than 8MB.

I have used wp_handle_upload_prefilter filter to check the upload size before uploading but it, but again for less that 8MB file I am able to check not more than that.

I just want to handle that issue. I don't want it to stop in option.php page

if ( '' !== $_FILES['html_resources']['name'] ) {
    if ( 'application/zip' === $_FILES['html_resources']['type'] ) {
        $upload = $_FILES['html_resources'];
        $file   = wp_handle_upload( $upload, array( 'test_form' => false ) );
    } else {
        add_settings_error( 'rdn-error', '', 'Please provide zip file!!', 'error' );

1 Answer 1


In order to change upload size limit two options have to be changed in php.ini configuration file - upload_max_filesize and post_max_size. These options cannot be changed at runtime so you will need to have access to php.ini in order to modify them. Example:

upload_max_filesize = 20M
post_max_size = 22M

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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