function format_value()
 {
     if (isset($_FILES[$this->name])) {
         require_once PLUGIN_DIR . 'attach.inc.php';
         $base = $this->form->base;
         $result = attach_upload($_FILES[$this->name], $base);
         if (isset($result['result']) && $result['result']) {
             // Upload success
             return parent::format_value($base . '/' . $_FILES[$this->name]['name']);
         }
     }
     // Filename not specified, or Fail to upload
     return parent::format_value('');
 }
Example #2
0
 function format_value($str)
 {
     if (array_key_exists($this->name, $_FILES)) {
         require_once PLUGIN_DIR . 'attach.inc.php';
         $result = attach_upload($_FILES[$this->name], $this->page);
         if ($result['result']) {
             return parent::format_value($this->page . '/' . $_FILES[$this->name]['name']);
         }
     }
     // ファイルが指定されていないか、アップロードに失敗
     return parent::format_value('');
 }