Skip to content

Commit

Permalink
FILESのfull_pathに対応
Browse files Browse the repository at this point in the history
  • Loading branch information
tokushima committed Aug 14, 2023
1 parent 8537c36 commit bf30e91
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions lib/ebi/Request.php
Expand Up @@ -31,8 +31,8 @@ public function __construct(){
}else{
$ks = implode('',array_map(function($v){ return '[\''.$v.'\']';},$pk));
$eval = 'if(isset($files[\'name\']'.$ks.') && !empty($files[\'name\']'.$ks.')){ ';
foreach(['name','tmp_name','size','error'] as $k){
$eval .= '$map'.$ks.'[\''.$k.'\']=$files[\''.$k.'\']'.$ks.';';
foreach(['name','tmp_name','size','error','full_path'] as $k){
$eval .= '$map'.$ks.'[\''.$k.'\']=$files[\''.$k.'\']'.$ks.' ?? \'\';';
}
eval($eval.'}');
}
Expand Down Expand Up @@ -196,6 +196,7 @@ public function file_vars(string $key, $file): void{
}else if(is_file($file)){
$this->files[$key] = [
'name'=>basename($file),
'full_path'=>basename($file),
'tmp_name'=>$file,
'size'=>filesize($file),
];
Expand Down Expand Up @@ -323,6 +324,16 @@ public function file_original_name($file_info): ?string{
}
return isset($file_info['name']) ? $file_info['name'] : null;
}
/**
* 添付ファイルのオリジナルフルパスの取得
* @param mixed $file_info string|array
*/
public function file_full_path($file_info): ?string{
if(is_string($file_info)){
$file_info = $this->in_files($file_info);
}
return isset($file_info['full_path']) ? $file_info['full_path'] : null;
}
/**
* 添付ファイルのファイルパスの取得
* @param mixed $file_info string|array
Expand Down

0 comments on commit bf30e91

Please sign in to comment.