You are here

function _fillpdf_get_file_contents in FillPDF 7.2

Same name and namespace in other branches
  1. 6 fillpdf.module \_fillpdf_get_file_contents()
  2. 7 fillpdf.module \_fillpdf_get_file_contents()

File

./fillpdf.module, line 957
Allows mappings of PDFs to site content

Code

function _fillpdf_get_file_contents($filepath, $error_goto = NULL) {
  $filepath = drupal_realpath($filepath);
  if ($error_goto && !file_exists($filepath)) {
    drupal_set_message(t('@filepath does not exist. Check your
      filesystem settings, as well as http://drupal.org/node/764936', array(
      '@filepath' => $filepath,
    )), 'error');
    drupal_goto($error_goto);
  }
  $handle = fopen($filepath, "r");
  $content = fread($handle, filesize($filepath));
  fclose($handle);
  return $content;
}