This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » Developer » Donwload link to FLV file

Donwload link to FLV file

Donwload link to FLV file

Friday 25 November 2011 3:51:59 pm - 5 replies

I want to add a link beside my home page video for downloading it. I added this link in my template:


<a href="{concat('/content/download/',$node.data_map.main_video.contentobject_id, '/', $,'/version/', $node.data_map.main_video.version , '/file/', $node.data_map.main_video.content.original_filename|urlencode)}">Download</a>


I can download my video but it's not readable with VLC, RealPlayer or others. I don't understand why.

I use ezPublis 4.2

Can you help me please?

Friday 25 November 2011 9:52:26 pm

Hello Christophe,

Welcome to the eZ Community!

Are you trying to download the file and only then localy try to play the file saved on disk or are you trying to 'stream' the file to one of your locally installed players?


Update: Oops, Your trying to play the file locally, well I leave the following examples in place here as a reminder to others looking for similar (but different) solutions.


There are different settings for the 'stream' use case in your file.ini.append.php settings override. Here is an example


Here is a great related thread, if you need, from,

Fyi, When I use the content/download module view, (from ezoe or in the browser url directly, including when I edit templates). I remove the 'version' parameter to ensure the file served to users is always the latest version (supported without need of use of version parameter in url). This also is useful in situation when content is updated (version number is incremented one) and older external content points to the older version of the url (very bad situation), if you make the conscious choice to omit the version parameter your urls will not expire when you publish new versions of the same file (very common for me).

You could also search the issue tracker for related 'existing' issues, to see if the issue your working with has been reported, fixed and released,

Though I must say I've never had (to my memory) or seen a problem with eZ not returning the same contents of the file as when I uploaded it into the system using the content/download module view.

As I re-read your example tpl code I wonder the following.

- Why not base your link code off the default template code provided by ezwebin say,

-- You'll notice they also omit the version param in the latest version of the above template

-- You'll also notice that they do not use the urlencode operator, they use the correct ezurl operator, consider trying ezurl instead. 

- I would also check that you do not have any other settings file overrides for file.ini.append.php anywhere in the system which change the above mentioned settings which for your use case you prolly do not want to change, but if this is an existing system you might have settings which your not aware of ... 

- Also you might benifit from testing an upgraded copy of your site or even a default installation (of the latest community builds, say 2011.09) to compare the differences between the two while testing to see if the new version of eZ solves this problem for you, as 4.2 is getting on in it's age ...

- Also I would consider creating a new video file object using a flash file you already have played locally and know to be 100% playable when uploaded into eZ Publish and try to download this new file uploaded, check for differences.

- On a unix-like platform I would also try to less/more (read, the first page) of the files, compare contents? Are you really getting flash files in return or something else? Hint also compare files sizes before and after.


I hope this helps ...




Modified on Friday 25 November 2011 10:11:06 pm by // Heath

Sunday 27 November 2011 4:50:20 pm

Thanks for your reply.

I tried a lot of thinks,
- the first, of course, was to use de default ezwebin gui
{attribute_view_gui attribute=$node.data_map.main_video}
- second, to use the url created by this gui
<a href={concat("content/download/",$node.contentobject_id,"/",$,"/file/",$node.content.original_filename)|ezurl}>Download 2</a> {$node.content.filesize|si( byte )}

And many others, with the same results.

Do you thnik this can be an effect of a bad server configuration. I try also "Addtype in my htaccess.

May be a bad configuration of my vhost ? I haven't any access of it. How can I test this hypothesis ?

Sunday 27 November 2011 6:22:04 pm

Hello Jena-Christophe,


Well while your talking a bit about the background (which, I had already assumed, as this is the standard) which is good, what your (thus far) not talking about is what bothers me most (when reading your replies).

  • This issue (still not very well described) could still be a rather large number of different things. Try describing the process to recreate your test case (every step please, be verbose). If you share reproduction instructions then everyone can test your issue much more directly.
  • Your not describing the process you use to re-create this behavior (as mentioned above) but your also not talking about testing with different uploaded binary file content (different flv files here, validated locally beforehand flv files so you know 100% they already work locally).
  • Your not talking about comparing the resulting file sizes, original file names or actual file contents. What is the real difference between the original files and the files downloaded? This is I think essential to solving this problem because only when you know (at least a bit more) what might be causing this inconsistency between the two files.
    • Once you know the difference you can seek out a cause
      • File size (review this first), if you don't have duplicate filesize you did not get the same content in return (in most cases)
      • File content (review this second), looks like valid content but the file size is too small, you may have not got the whole file. What might stand between your request to download and the server here?
      • File content does not match the original at all, and downloaded file size is way too small. You may have not even gotten the right file, read the downloaded file as text (you can use thousands of programs to do this, some more useful than others -be smart here-), did you get an html file contents (does it contain any related error messages or text? where did it come from and how did you get it, etc), did you get a text file of some other kind, all to answer the question of what you got and why you got it.
      • File content is not text, is binary, but does not look anything like original which might suggest some sort of corruption during file upload, storage transformation (storing in eZ) or download 

I say all of the above because I'm really trying to understand in (a lot more detail) just how your reaching this result and what exactly those results are in terms of downloaded file properties and content composition. You just gave up and said, 'it doesn't work! what is wrong with eZ??', but in most use cases it's quite the opposite way around (in terms of actual responsibility).


A lot of things could be going on including the webserver configuration, proxy, etc but lets stick to your latest reply template code examples. I think this is a key focus ... I'll explain.


I think you were smart to try to use the attribute view gui, (you can customize the template overrides it uses as well!) I would recommend sticking to using it if you can ... (as it results in cleaner template code) ... in short your overriding the wrong template for this use case.


Also I notice just now that your original forum message template code example is also missing the content object attribute id url parameter as well. Check default template code in the link I shared above (and again below).


I'm most concerned today because I see in the latest template code, in your most recent reply, a serious mistake in the code.


Where you use $ in your code, " {concat("content/download/",$node.contentobject_id,"/",$,"/file/",$node.content.original_filename)|ezurl}>Download 2</a> {$node.content.filesize|si( byte )} " I believe you should not use $ in this url (at all). Instead here you I believe you should use the content object attribute id (Re: my previous link to the template (and code) used by ezwebin by default).

Where you use $node.content in your code, " {concat("content/download/",$node.contentobject_id,"/",$,"/file/",$node.content.original_filename)|ezurl}>Download 2</a> {$node.content.filesize|si( byte )} " I believe you should not use $node.content in this url (at all). Instead here you I believe you should use the content object attribute content (Re: my previous link to the template (and code) used by ezwebin by default).

You seem to to have just copied code and renamed variables to use code out of original scope / context (ie: trying to use datatype template code in node template code, bad practice!). So most of the variable names your using are wrong and would not result in normal execution (or valid results).

In this case you are prolly using code out of context and not using the correct variables ... which could be at least part of your problems ..

You need to override the correct template and leave the code variable names (and a bulk of the already well tested and working by default code alone :\)


Again I recommend you override this template (but only if you need to)


But only if you -must-, why might I ask, are you trying to customize this template? To what end are you trying to reach? The default templates should work by default very well, I don't see what value you could gain in tampering with this aspect of the eZ Publish system (based on the limited information and examples you have shared thus far ..) So far I see you only introducing template code errors ...


Also it strikes me that entering the wrong ids in the url would generate incorrect results, possibly in the manner you described ...


One way to confirm the url contents (as a test) before downloading files with it is to use the admin to view the file and validate that the url you wish to test is using the same values (ids) within it's url parameters as the values displayed in the admin for this file object.

This is also how I would test the url to validate it is 100% accurate before ever downloading the contents. Though I suspect with the use of the right url you will get the same contents downloaded as the original and will play the same as well.


Also I note that if you were using the above template code, you would not be getting a random downloaded file with the wrong content, in most use cases you would get a module view error page (kernel error), So you should have noticed this difference and reported it in the forum along with the template code which did not work ... if you don't give use accurate results in your reports we might not be able to help you.


This is what I would focus on getting right first, long before ever even starting to look into web server, browser or proxy configuration issues which here really do not seem to be the cause.


I hope this helps ...




Modified on Sunday 27 November 2011 6:24:10 pm by // Heath

Sunday 27 November 2011 6:29:19 pm

Oh my god !

Your last proposal solve my problem. I compared my flv file after upload and before download. I found a break line in first. I supressed this line adn i can read my file.

I searched a break line in my index.php and i found it.

The most stupids errors are the more difficults to find.

Thank you very much for you help.

Sunday 27 November 2011 6:45:24 pm

Hello Jena-Christophe,


I'm very pleased you have found the answer to your problems.

You really do have to watch out for editors which allow trailing newlines in files written to disk, they will really bite you in the end when working with PHP code in most use cases (eventually).


Would you do one last thing for us here on Would you flag your forum question as solved, ie: login and click the forum message checkbox (at the top of the forum message)? This helps us now and others later.


Thank you for your continued support! Best wishes ...





You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from