Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Programmatically create file-download link (file_entity / Drupal)>
<?php
// Get download uri of actual file.
$uri = file_entity_download_uri($file);
// We need query-params for download-token here.
$dl_link = l(t('Download'), $uri['path'], array('query' => $uri['options']['query']));
print $dl_link;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.