Share » Forums » Setup & design » How to rename an uploaded file with...

How to rename an uploaded file with her original filename ?

How to rename an uploaded file with her original filename ?

Friday 22 December 2006 6:21:06 am - 4 replies

Author Message

Claudia Kosny

Saturday 23 December 2006 7:04:36 am

Hi Sebastien

Are you sure that you need to do this? At least on EZ 3.8.3 the file is stored in the var directory under a name like you mentioned, but it I use the default template for displaying a link to this file, I get a link to /content/download/<object_id>/<attribute_id>/file/original_filename.mp3

So if you have a look at the template design/base/override/templates/datatype/ezbinaryfile.tpl, you can see how they create a link with the original filename.

Claudia

Sébastien Antoniotti

Tuesday 26 December 2006 12:13:58 am

Hi Claudia,

The problem is that I cant display the link using attribute_view_gui because, I need to custom the link :

<a title="Télécharger {attribute_view_gui attribute=$p.data_map.titre} - (clic droit, puis Enregistrer la cible sous)" href="{$p.data_map.son.content.filepath|ezroot('no')}" style="margin-right:3px;width:30px;height:30px;float:right;display:block;"></a>  

Thanks for your help !

eZ Publish Freelance
web : http://www.webaxis.fr

Claudia Kosny

Tuesday 26 December 2006 2:04:06 am

Hi Sebastien

Just have a look at the template for ezbinary, there you can see how to create a link for downloading a binary file. The result should look roughly like this (not tested at all):

<a title="Télécharger {attribute_view_gui attribute=$p.data_map.titre} - (clic droit, puis Enregistrer la cible sous)"
href={concat("content/download/",$p.data_map.son.contentobject_id,"/",$p.data_map.son.id,"/file/",$p.data_map.son.content.original_filename)|ezurl} 
style="margin-right:3px;width:30px;height:30px;float:right;display:block;">
{$p.data_map.son.content.original_filename|wash(xhtml)}</a>

Claudia

Sébastien Antoniotti

Tuesday 26 December 2006 5:23:42 am

It works very well !

Thanks a lot for this helpful feature !!

eZ Publish Freelance
web : http://www.webaxis.fr

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

36 542 Users on board!

Forums menu