예제 #1
0
 /**
  * @group set_upload_file_keys
  */
 public function test_set_upload_file_keys_ファイルがなければNull()
 {
     $wp_upload_dir = wp_upload_dir();
     $this->Data->set('file', $wp_upload_dir['url'] . '/1.txt');
     $this->Data->push(MWF_Config::UPLOAD_FILE_KEYS, 'file');
     $this->Data->set_upload_file_keys();
     $this->assertSame(array(), $this->Data->get_post_value_by_key(MWF_Config::UPLOAD_FILE_KEYS));
 }
예제 #2
0
 /**
  * ファイルアップロード処理。実際のアップロード状況に合わせてフォームデータも再生成する。
  */
 protected function file_upload()
 {
     $File = new MW_WP_Form_File();
     $files = array();
     $upload_files = $this->Data->get_post_value_by_key(MWF_Config::UPLOAD_FILES);
     if (!is_array($upload_files)) {
         $upload_files = array();
     }
     foreach ($upload_files as $key => $file) {
         if ($this->Validation->single_check($key)) {
             $files[$key] = $file;
         }
     }
     $uploaded_files = $File->upload($files);
     $this->Data->set_upload_file_keys();
     $this->Data->push_uploaded_file_keys($uploaded_files);
 }