You are here

function _filefield_preview in FileField 5.2

Same name and namespace in other branches
  1. 5 filefield.module \_filefield_preview()

transfer a file that is in a 'preview' state. @todo multiple support

1 string reference to '_filefield_preview'
filefield_menu in ./filefield.module

File

./filefield.module, line 68
Defines a file field type.

Code

function _filefield_preview() {
  foreach ($_SESSION['filefield'] as $fieldname => $files) {
    foreach ($files as $delta => $file) {
      if ($file['preview'] == $_GET['q']) {
        file_transfer($file['filepath'], array(
          'Content-Type: ' . mime_header_encode($file['filemime']),
          'Content-Length: ' . $file['filesize'],
        ));
        exit;
      }
    }
  }
}