Search

A new extension, “Force Download” is now available for download. Comments and feedback can be left here but if you discover any issues, please post it on the issue tracker.

Force Download updated to version 1.1 on 22nd of October 2010

  • put event into extension structure.
  • implemented ‘download this page’-functionality.

@kanduvisla. This isn’t working for me. The extension installed OK. I have edited the config file like this:

<?php
    // The directories that are allowed to download from:
    $allowedDirs = array(
            'workspace/uploads/property_pdf'
    );

My link looks like this:

<a href="/download/?file=workspace/uploads/property_pdf/file.pdf">

But I get a 404 error when I click the link. Can you think of any reason why it wouldn’t work? Are there any permission requirements on the extension files?

If I point directly at the file, the PDF loads in the browser, so the file is definitely visible.

Attachments:
Screen shot 2010-12-28 at 15.45.42.png

I solved this by doing 2 things:

  1. Creating a page called download.
  2. Adding the event “Force download” to that page.

Works perfectly now.

Neither of these (perhaps obvious) steps were mentioned in the documentation. I don’t know the protocol for issue requests and documentation, but should I raise an issue request to add the above to the documentation?

I don’t know the protocol for issue requests and documentation, but should I raise an issue request to add the above to the documentation?

With extensions there’s no rule really. You could either open an issue on the extensions issue tracker, or if you’re more technically inclined you could fork the repo on Github, make your changes (presumably adding a tutorial or steps to the README) an send a pull request to the original owner to merge it into their project and release a new version.

The first line of the readme states:

When this event is attached to a page, it enables the page to force a download

…so from that it seams pretty clear to me that you have the attach the event to a page in order for the event to work. Or should I rephrase it?

Hi @kanduvisla

It was more the creation of the new page “download” that I wasn’t clear on. I presumed that like the JIT image path which starts /image/ even though there isn’t a page called “image”, there was some kind of rewrite going on behind the scenes t make the /download/ URLs work. If others read it like me, it might be worth adding that the page needs to be created. The rest is clear enough to me.

Thanks

Thanks for a great extension - works like a charm!

I had the same issue as Stuart though. I attached the event to the page but this line:

<a href="/download/?file=workspace/uploads/manual.pdf">Download manual</a>

doesn't make it clear that the first part is actually the page the event is attached to (i made the same assumption about it being similar to JIT).

In my case the event is attached to the same page my link is on so my URL actually looks like:

<a href="?file=workspace/uploads/manual.pdf">Download manual</a>

Perhaps this is obvious to others because it's using a URL param, but I think it would help to point this out to people.

Even something as simple as:

    <a href="path/to/your/page?file=workspace/path-to-download/your-file.pdf">Download manual</a>

Might do it.... and mentioning that it uses URL Params?

Thanks again for a great extension.

<a href="?download=about.xsl">Download sheet in XML-format</a> -i have lik this <a> tag in order to download the my page but its does not works , how to download the current page using this extension

Hi How to download the pages as pdf... any suggestions on this...............

Help me on this..........

@priya, a please would be nice.

Downloading a page as a PDF isn't something you can do very easily, you will need to find an HTML to PDF converter and build an extension to do it.

There has been discussion on this forum about it previously, you may want to search for it then spend some time reading through it.

You could simply specify a PDF mime type and the browser would be tricked into thinking it's a PDF. But it won't be PDF data. If you want to create a PDF using Symphony you could try these threads:

Thank u so much. I will work on this.

I have a strange issue with this:

I used this extension without issues, but at one point it stopped working.

The issue is on line 78 in event.force_download.php

include_once('event.force_download.config.php');

It includes the config but the content of included file doesn't get included :|

What happens? Empty $allowedDirs and $mime_types.

Force Download updated to version 1.2 on 9th of May 2012

  • Updated for S2.3
  • If you're using Symphony prior to 2.3, download the 1.1-tag instead.

This is not working in 2.3. I see someone has already logged it as an issue but unfortunately I don't know how to fix it.

I think I ran into this problem a couple of months back, can't remember for sure but I think it might be something to do with the configuration not being written during installation, try having a look in your manifest/config.php for a section titled FORCE_DOWNLOAD, if it isn't there you could try adding the following: -

###### FORCE_DOWNLOAD ######
'force_download' => array(
    'trusted_locations' => 'a:1:{i:0;s:19:"workspace/downloads";}',
),
########

Then try reloading the preferences page, that might do it. Problem is though I don't know what the serialised a:1, i:0 and s:19 reference so the above might not work with your install. (Sorry this is all off the top of my head). Hope it helps.

a:1:{i:0;s:19:"workspace/downloads";}

a = array(), i = integer, s = string.

The numbers may mean more to you now. It's how PHP serialises data to be stored in a string using serialize() and unserialize().

Could you try it now with the latest master branch?

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details