I am using ACF plugin and trying to get file size which in a repeater field, but it returns nothing. Here is my code.
<?php if(have_rows('download')) : ?>
<ul class="file">
<?php
while(have_rows('download')) : the_row();
?>
<li class="custom-ul-class col-md-6 col-sm-12 col-xs-12">
<span class="file-size">
<?php
$attachment_id = get_sub_field('file');
$url = wp_get_attachment_url( $attachment_id );
$title = get_the_title( $attachment_id );
$filesize = filesize( get_attached_file( $attachment_id ) );
$filesize = size_format($filesize, 2);
echo $filesize;
?>
</span>
</li>
<?php endwhile; ?>
</ul>
<?php endif; ?>