Support

Account

Home Forums Front-end Issues Image fields with required and filesize upper limits do not working.

Solved

Image fields with required and filesize upper limits do not working.

  • Hi friends.

    I use ACF PRO 5.7.0 and I try to upload image with acf_form.

    First, create field-group and IMAGE type custom field(required : true and Maximum filesize : 2).
    Next, write this code in page-image_uploader.php.

    acf_form(array(
    	'post_id' => 'new_post',
    	'post_title' => true,
    	'fields' => array('image_description', 'uploaded_image'),
    	'html_after_fields' => '<input type="hidden" name="posted_post_type" value="image_uploader" />',
    	'return' => '%post_url%',
    	'uploader' => 'basic',
    	'new_post' => array(
    		'post_type' => 'uploaded_image'
    	),
    	'submit_value' => 'send'
    ));

    Without problems In the case of images of 2MB or less.
    However, if I upload images larger than 2MB, only the image will disappear but post will be created.
    For images larger than 20MB(It is the upper limit of php.ini), an error is displayed and no post is created.

    I tried the following code as a trial.

    function my_acf_prefilter( $errors ){
    	var_dump($errors);
    	exit;
    }
    add_filter('acf/upload_prefilter', 'my_acf_prefilter', 10, 1);

    Return this.

    array(1) {
      ["max_size"]=>
      string(36) "File size must must not exceed 2 MB."
    }
  • Just to confirm. This is happening when the user is not logged in?

  • Hi @hube2

    This problem happens whether logged in or not.
    The only way to succeed is to logged in with administrator and acf_form parameter 'uploader' => 'basic', change 'uploader' => 'wp',

  • Please submit a new support ticket here/bug report here https://www.advancedcustomfields.com/contact/. This has something to do with the basic uploader and I don’t know if it can be corrected or not.

  • @hube2
    Okey, now send a message.
    Thanks!

  • Sorry, what was the solution here?

  • @zachmihalko
    In the end, no solution was found…

  • In case anybody has the same problem as described at the top of this topic.

    I’m using the plugin WP User Avatar which has a file size delimiter set. On the settings page of the avatar plugin you can adjust the upload size limit.

    So if you have the same issue as described above, please check EVERY plugin for any upload limits. In case of any doubts deactivate the plugins one after another.

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘Image fields with required and filesize upper limits do not working.’ is closed to new replies.