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();
?>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.