Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8154193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:15:36+00:00 2026-06-06T16:15:36+00:00

I am trying to send a file to the browser in a Zend Framework

  • 0

I am trying to send a file to the browser in a Zend Framework PHP application. I found an action helper here – https://github.com/noginn/noginn/blob/master/Noginn/Controller/Action/Helper/SendFile.php

In my controller I have an action like this

public function downloadfileAction()
{
    //get the file name and strip out all white spaces
    $title = preg_replace('/\s+/', '', $this->getRequest()->getParam('title')); 

    //create the file path          
    $path = 'downloads/'.$title.'.pdf';

    //call the action helper to send the file to the browser
    $this->_helper->SendFile->sendFile($path, 'application/x-pdf');
}

my file is located in my public folder ie MyApp/public/downloads/myFile.pdf

When I run the action, I get a view file not found error and the download is not started.

exception 'Zend_View_Exception' with message 'script 'myController/downloadfile.phtml' not found ...

Can anyone suggest what I am doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T16:15:37+00:00Added an answer on June 6, 2026 at 4:15 pm

    It’s an error about the script-(view)-file what can’t be found. Cause you don’t need one when sending output.

    Try disable it by this this:

    public function downloadfileAction()
    {
        //get the file name and strip out all white spaces
        $title = preg_replace('/\s+/', '', $this->getRequest()->getParam('title')); 
    
        //create the file path          
        $path = 'downloads/'.$title.'.pdf';
    
        //call the action helper to send the file to the browser
        $this->_helper->SendFile->sendFile($path, 'application/x-pdf');
        $this->_helper->viewRenderer->setNoRender();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to send a file to the browser to download, and not having
I'm kind of new to php, and I'm trying to send a file through
am trying send an array to php file using $_POST ,still always getting an
I'm trying to send form fields and file to a web service using php
I am trying to send a suggestion from my app to a php file
I am trying to send an OOXML Excel file to the browser based on
I'm trying to send intent to browser to open local file. I wish to
I'm trying to send a file in chunks to an HttpHandler but when I
I've been trying to send a file to an ftp server via an FTPClient
I'm trying to send a PDF file for a Kindle device. If I send

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.