Support » Developing with WordPress » Send Zip file as response rest API

  • Ashish Jangra

    (@ashishjangra-1)


    Hey Folks

    We would like to send zip file as REST response. I have tried to set following header

    // Headers for an download:
    header(‘Content-type: application/zip’);
    header(‘Content-Disposition: attachment; filename=”yourarchive.zip”‘);
    header(‘Content-Transfer-Encoding: binary’);
    // load the file to send:
    readfile(‘yourarchive.zip’);

    but its not working. I don’t want to send URL of zip file.

    Thank you in advance.

  • You must be logged in to reply to this topic.