Download files

Author Message

James Packham

Monday 22 September 2003 5:25:09 am

Hi, I know this is a bit of a newbie question, but I want visitors to my site to be able to click and download pdfs. I can't find the documentation on how to do this, could somebody point me in the right direction please?

Tony Wood

Monday 22 September 2003 5:34:30 am

Try the demo 'intranet site' it contains an example of this.
To use just add a new 'file' via admin interface and its a simple as that :)
Once you have seen it working, take a look at the template and see how it works.

I hope this helps

tony

Tony Wood : twitter.com/tonywood
Vision with Technology
Experts in eZ Publish consulting & development

Power to the Editor!

Free eZ Training : http://www.VisionWT.com/training
eZ Future Podcast : http://www.VisionWT.com/eZ-Future

James Packham

Monday 22 September 2003 5:51:58 am

Thanks

James Packham

Monday 22 September 2003 7:41:29 am

Ok, sorry to bother you all again but I'm still having trouble. Whenever I go upload a pdf file through the admin interface I get returned to the create file screen.

If I try to upload images it works, no problems. The only clue to why this happens is the debug output:

Warning: PHP Sep 22 2003 15:33:01
Undefined variable: links in /var/www/html/ezpublish-my-sites/kernel/classes/datatypes/ezxmltext/handlers/input/ezsimplifiedxmlinput.php on line 1606

Warning: PHP Sep 22 2003 15:33:01
Undefined variable: node in /var/www/html/ezpublish-my-sites/kernel/classes/datatypes/ezxmltext/handlers/input/ezsimplifiedxmlinput.php on line 1629

Does anybody know what this means? I've changed the maximum file size to 6mb (my pdf is 3mb) so I'm pretty sure this isn't the problem and the fact that I can upload images to the folder means that it isn't a read/write problem (both files also have same permissions and owners as well)...

Anybody had a similar experience?

James Packham

Monday 22 September 2003 7:56:36 am

Seems that this was due to a problem with the pdf file ??? I don't know why, but when I made a fresh one and tried to upload it... Voila! It worked :) Just one problem though - how do I create a link in an article?? I used the <link> method to http://192.168.0.1/news/media/pdf/fm.pdf (that being the location due to my virtual hosting arrangement) but I just get a "kernel 20 module not found" apparently it can't find the module "media" so I guess I'm using the link in the wrong way... even though I specified the class as a file... Oh and I added it to the location "root folder".

Tom Couwberghs

Tuesday 23 September 2003 12:06:12 am

As with all ezp objects, you should access this file with the /content/view/full syntax.

The easiest way to do this is to use the related objects box on the right when you're editing something (e.g. an article, forum message, ...). Just click on the magnifying glass there and then you can select the object you want. If you select an object you'll be redirected to the editing page. You wil notice that some code like "<object id='XXX' />" appears in the box. Just copy paste that code in the body of an article or .... and you're done.

If you want a list of all pdf's that are stored in a specific folder, you should do a fetch of the folder. Just browse to the folder in default design for an example.

HTH Have fun!

James Packham

Tuesday 23 September 2003 4:46:39 am

I think you missunderstood what I meant. I simply want a link that when a visitor clicks they can either open or download the pdf.

Do I really have to create a new template to do this? I just want the file to download!

James Packham

Tuesday 23 September 2003 4:51:10 am

Ok, no need to worry I have figured this out now.

For anyone who is interested:

find file using the related items tool
When it appears in the editing section for you article click on the link to the file
In the file details copy link location for the file and use this as the link in your article.

Ilya Tsymbal

Tuesday 13 December 2005 10:26:32 am

I figured out how to do this in a somewhat round-about way, in EZP 3.7.
In your admin interface, create and upload the file.
In your user interface, navigate to /media/files. Your file should be listed there; You can copy the URL and use in your .tpl template file.
The URL for me was of the form
http://www.sitename.com/content/download/173/734/file/file_name.pdf
173 is the object ID (not node ID). I don't know what 734 is.

Ilya Tsymbal
Senior Developer
Optaros.com

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.