Forums » Alpha Release Candidate

How to add link to download original

(2 posts)
  • Started 9 months ago by niceoutfit
  • Latest reply from davelester
  • This topic is closed
  • This topic is not a support question
  1. 9 months ago # | |

    I would like to provide a download link the original source file that was uploaded. Could you provide the code needed to do so.

  2. You've probably seen this called on the admin side on the items show page:

    <?php echo display_files($item->Files); ?>

    That displays the file and the download link. It looks like this is what you want. Take a look at display_files() in the application/helpers/Functions.php file to see how it works if you are looking to build something of your own. $files can be an array, so you just have to handle that properly, and you could echo something as follows:

    echo '<a href="'. file_download_uri($file). '" class="download-file">'. $file->original_filename. '</a>'

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.