/**
  * Handles GET requests for a binary field
  * The relevant get variables are:
  *<ul><li> cat -- the I2CE_FileSearch category we should be looking for</li>
  *    <li> name -- the filename we are looking for</li>
  *</ul>
  *As an alternative (mainly b/c libxml's xmlSetProp (which is used by PHP's DOM) which
  * will automatically escape &)  you can set the variable encoded=ENC_BLAH   where ENC_BLAH is
  * an urlencoded string  with the cat and name variables set e.g urlencode("cat=SCRIPTS&name=somescript.js")
  */
 public function display($supress_output = false)
 {
     if ($_SERVER['REQUEST_METHOD'] != "GET" && $_SERVER['REQUEST_METHOD'] != "HEAD" || !$this->request_exists('formid') || !$this->request_exists('field')) {
         //do nothing if it is not a GET request
         exit;
     }
     $field = $this->request('field');
     $formid = $this->request('formid');
     if ($this->request_exists('tmp_key')) {
         if (!($formObj = I2CE_FormFactory::instance()->createContainer($formid)) instanceof I2CE_Form) {
             exit;
         }
         if (!$field || !($fieldObj = $formObj->getField($field)) instanceof I2CE_FormField_BINARY_FILE) {
             exit;
         }
         $fieldObj->setTempKey($this->request('tmp_key'));
         $fieldObj->setFromTemporaryTable();
     } else {
         if (!$this->request_exists('formid')) {
             exit;
         }
         if (!($formObj = I2CE_FormFactory::instance()->createContainer($formid)) instanceof I2CE_Form) {
             exit;
         }
         if (!$field || !($fieldObj = $formObj->getField($field)) instanceof I2CE_FormField_BINARY_FILE) {
             exit;
         }
         $formObj->populate();
     }
     //we are good to go  dump and die.
     $cacheTime = 60;
     // defaults to 1 minute
     if (I2CE::getConfig()->setIfIsSet($cacheTime, '/modules/BinFields/cache_time')) {
         $caheTime = $cacheTime * 60;
     }
     I2CE_Dumper::prepForDump($fieldObj->getModTime(), $fieldObj->getContentLength(), $fieldObj->getHeaders(), $cacheTime);
     echo $fieldObj->getValue();
     exit;
 }