link_to is meant from internal uri's, and by that I mean either a route name (@whatever) or a module/action string. I've had trouble with this myself. You've probably already found that it strips off the 'uploads' part of the string.
To get this to work you'll have to add the absolute=true option to the function. You also might want to get the uploads directory from the symfony configuration, and add your own helper function to handle it more succinctly. So in /lib/helper you might add something like UrlCustomHelper.php: function link_to_file($label, $filename, $directory=null) { if ( is_null($directory) ) { $directory = '/'.basename(sfConfig::get('sf_upload_dir')); } return '<a href="'.url_for($directory.'/'.$filename).'">'.$label.'</ a>'; } And then you can add UrlCustom to your standard_helpers in settings.yml Anyone have a nicer solution? ===== Jonathan Montgomery http://jonocode.wordpress.com On Sep 27, 9:54 am, dagger <strategy.vs.lo...@gmail.com> wrote: > Hi, > > A simple question... How can i create a download link to a file > uploaded to uploads directory under web of symfony? > > something like - <?php echo link_to('download file', 'uploads/ > file.pdf')?> > > thanks for the reply --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---