[development] links

Amr Mostafa amr.mostafa at gmail.com
Mon Apr 23 12:45:06 UTC 2007


On 4/23/07, Ashraf Amayreh <mistknight at gmail.com> wrote:
>
> What about referencing files in the files directory?


Sorry I forgot to answer this part.. base_path() would solve it in your
example <?php print base_path(). file_directory_path() .'/whatever.zip'; ?>
but it's a wrong approach, file_create_url() is the correct function to use
here as it will honor the private/public download option in the site
configuration.

So a typical way to generate a download link to a file is: l(t('Download'),
file_create_url($filepath)); where $filepath is the path to the file
relative to the files directory.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20070423/1171f7b0/attachment.htm 


More information about the development mailing list