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

  • Home
  • SEARCH
  • 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 552299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:29:05+00:00 2026-05-13T11:29:05+00:00

When using Symfony 1.0, is it possible to create a link to a static

  • 0

When using Symfony 1.0, is it possible to create a link to a static file i.e. a PDF or DOC file and link to it a custom URL?

I’d like to add a file e.g. example.pdf to the web/uploads/pdf folder on the server but then link to it with a URL such as: http://www.example.com/docs/old/test/example.pdf

This situation has arisen because some printed documentation from before the development of a new web site points to the specified URL.

  • 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-05-13T11:29:05+00:00Added an answer on May 13, 2026 at 11:29 am

    Ok, I have figured it out (with a great deal of help from this blog post. Thanks Thaberkern)

    Create a route to grab the file name:

    legacy_docs:
      url: /docs/:filename.pdf
      param: { module: default, action: display_pdf }
    

    Then create an action to output the pdf:

      public function executeDisplayPdf()
      {
        $filename = $this->getRequestParameter('filename');
    
        $path_to_pdf = 'http://'.sfConfig::get('website_hostname').'/uploads/'.'/'.$filename.'.pdf';
    
        //create the response object
        $this->getResponse()->clearHttpHeaders();
        $this->getResponse()->setHttpHeader('Pragma: public', true);
        $this->getResponse()->setContentType('application/pdf');
        $this->getResponse()->sendHttpHeaders();
        $this->getResponse()->setContent(readfile($path_to_pdf));
    
        //set up the view
        $this->setLayout(false);
        sfConfig::set('sf_web_debug', false);
    
        return sfView::NONE;
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using propel master-dev with symfony 2.1. Is possible to write something like that
I'm using Symfony 1.4 with the Doctrine 1.2 plugin. I would like to add
im using symfony with doctrine, and Im trying to generate the schema yml file
In Symfony2 form component is it possible to create custom attributes? The reason why
I'm using Symfony 1.4 and wondering whether it's possible to achieve the following: <a
I am doing something very similar to this cookbook example http://symfony.com/doc/current/cookbook/form/dynamic_form_generation.html#adding-an-event-subscriber-to-a-form-class The main difference
I am developing an application using Symfony 1.4. Is it posible to disable a
we using symfony 1.0. We have an module work with Propel objects. The sql-querys
I'm using Symfony 2.1-dev and am having problems when authenticate users using a form.
I am using symfony 1.0 and have set routing for few URLs as below.

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.