Support

Account

Home Forums ACF PRO Zip download of all .vcard files from File field Reply To: Zip download of all .vcard files from File field

  • I think I am getting closer. The code below is returning the file paths but not creating the zip. Should I be using get_attached_file here?

    <?php $files_to_zip = array(); // create array
    $blogusers = get_users();
    $zip = new ZipArchive;
    $zip->open('file.zip', ZipArchive::CREATE);
    foreach ( $blogusers as $user ) { 
    $zip->addFile(the_field('upload_vcard', 'user_'. $user->ID )); }
    
    print_r($files_to_zip);// debug - return file names OK
    
    $zip->close();
    ?>