Hey Gareth,
That unfortunately also doesnt work; gives a url like:
<a href="
http://site1.localhost/C%3A%5Cdev%5Csymfony-workspace%5CtheAppName%5Cweb/files">Download
File</a>
I just did something ghetto and figured out how to calculate path based on
where web directory is in web root folder which works on both servers...
<?php
//quick way to normalize filepaths, converts / or \ to same style for
both dirs
$server_root_dir = realpath($_SERVER['DOCUMENT_ROOT']);
$sf_web_dir = realpath(sfConfig::get('sf_web_dir'));
//get path after root
$path = str_replace($server_root_dir,'',$sf_web_dir);
return '<a href="' . $path .'/'. $this->getFileName() . '"
target="_blank">Download Report</a>';
?>
so if webroot is
C:/dev/symfony-workspace/site1/web
and
web folder is
C:/dev/symfony-workspace/site1/web
(aka probably apache conf file has alias setup for symfony so front
controller handles everything automatically)
$path is '', so
so then it just gets files/blah.xls from db field and filepath is <a
href="/files/blah.xls">
if webroot is
/var/www/html
and
web folder is
/var/www/html/symfony_dir/web
(aka symfony project is just a sub directory on server and user manually
goes to /web url on server to access symfony, like our 'prod' setup)
path is 'symfony_dir/web', so
so then filepath is <a href="/symfony_dir/web/files/blah.xls">
On Mon, Oct 19, 2009 at 2:02 AM, Gareth McCumskey <[email protected]>wrote:
> link_to("Download File",
> sfConfig::get('sf_web_dir')."/".$this->getFileName());
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---