1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Send ZIP File to Browser

Discussion in 'XenForo Development Discussions' started by ragtek, Nov 7, 2010.

  1. ragtek

    ragtek Guest

    How can i send a zipfile from the server to the browser?

    Are there any XenForo methods for this?
    NOrmaly i would use header(...) but it's not working
  2. Shadab

    Shadab Well-Known Member

    From inside the xenforo framework?

    Take a look at the how xenforo handles attachment viewing, to get the idea. Specifically these two classes: XenForo_ControllerPublic_Attachment, and XenForo_ViewPublic_Attachment_View. Heres some sample code:

    /* In your Controller: */

    public function actionIndex()
    // Check the viewing user's permission.
        // Check if the zip file is accessible.
        // Any other check you want to perform.

        // Fetch the $zip file info (from db?).


    $viewParams = array(
    'download_name' => 'ragtek.zip',
    'file_path'     => $zip['file_path'],
    'file_size'     => $zip['file_size']

    /* In your View: */

    public function renderRaw()


  3. ragtek

    ragtek Guest

    Oh man, i've forgotten that i could check the attachment code for this:D

    thx very much, it's working great.
    I hope that my add-on package builder can be released soon
  4. Shadab

    Shadab Well-Known Member


Share This Page