function content_get_uploaded_file

6.x content.module content_get_uploaded_file($fid)
7 calls to content_get_uploaded_file()
content_content_load in modules/content/content.module
Implementation of content's hook_content_load
content_edit_content_form in modules/content/content.module
This form lets the user edit some piece of content
content_files_handle_download in modules/content/content.module
This actually finds and downloads the file for the user, decrypting if necessary.
content_files_user_may_download_file in modules/content/content.module
Returns TRUE or FALSE if the user has access to download this particular student's file.
content_public_files_form in modules/content/content.module
This screen lets the user upload/manage/delete "public files" stored at custom/files/content_uploads/public_uploads/

... See full list

File

modules/content/content.module, line 1320

Code

function content_get_uploaded_file($fid) {
  $res = db_query("SELECT * FROM content_files WHERE fid = ?", array($fid));
  $cur = db_fetch_array($res);

  if ($cur) {

    $temp = explode(".", $cur ['filename']);
    $ext = $temp [count($temp) - 1]; // get the extension.

    $cur ['full_filename'] = fp_get_files_path() . '/content_uploads/' . $cur ['filename'];
    // also get the URL for downloading this file.
    // If this file was encrypted, then the url should change to the url to decrypt this particular file (probably by passing it the fid)
    //if (intval($cur['is_encrypted']) === 1) {

    // *** Always handle downloads through FlightPath, for security reasons. ***  

    $cur ['url'] = fp_url('content-files/handle-download/' . $cur ['fid']);
    //} 
    //else {
    //  $cur['url'] = base_path() . "/custom/files/content_uploads/" . $cur['filename'];
    //}
    $cur ['ext'] = $ext;
  }

  return $cur;

}