Example #1
1
 public function show()
 {
     if (false === empty($this->output)) {
         $path = $this->fileinf;
         if ($path !== false) {
             File::output($path, $this->chunk, $this->delay);
         } else {
             echo $this->output;
         }
     }
     if ($this->clean) {
         $this->fileinf = false;
         $this->output = null;
         App::off('ready', array($this, 'show'));
     }
 }
Example #2
1
 public function show()
 {
     File::output($this->cacheName, 1024);
 }
Example #3
1
 public function show()
 {
     if (filesize($this->cacheName) > 524287) {
         File::output($this->cacheName);
     } else {
         readfile($this->cacheName);
     }
 }
Example #4
0
 /**
  * attachmentで出力する
  * @param File $file 出力するファイル
  */
 public static function attach(File $file)
 {
     Log::disable_display();
     if (is_file($file->fullname()) || $file->value() !== null) {
         if ($file->update() > 0) {
             if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && $file->update() <= strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
                 self::status_header(304);
                 exit;
             }
             header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $file->update()) . ' GMT');
         }
         header(sprintf('Content-Type: ' . $file->mime() . '; name=%s', $file->name()));
         header(sprintf('Content-Disposition: attachment; filename=%s', $file->name()));
         if ($file->size() > 0) {
             header(sprintf('Content-length: %u', $file->size()));
         }
         $file->output();
     }
     self::status_header(404);
     exit;
 }
Example #5
0
File: Http.php Project: hisaboh/w2t
 /**
  * attachmentで出力する
  * @param File $file
  * @param string $contentType
  */
 public static function attach(File $file, $contentType = "")
 {
     if (empty($contentType)) {
         $contentType = "application/octet-stream";
     }
     header(sprintf("Content-Type: " . $contentType . "; name=%s", $file->name()));
     header(sprintf("Content-Disposition: attachment; filename=%s", $file->name()));
     if ($file->size() > 0) {
         header(sprintf("Content-length: %u", $file->size()));
     }
     $file->output();
 }