Home Forums General Issues get filesize? Reply To: get filesize?

  • this way i get a size:

    <?php $attachment_id = get_field('download');
    $url = wp_get_attachment_url( $attachment_id );
    $title = get_the_title( $attachment_id );
    if (get_field('download')): ?>
    <a href="<?php echo $url; ?>" ><?php echo $title; ?></a>
    $file_size = $attachment_id;								echo size_format($file_size, 2);									?>								
    <?php endif; ?>

    but its not the size of the file it’s always about 1kb, i think it’s the size of the “ID” itself? i get the title with “get_the_title” but how do i get the size in MB?