Changeset 18819 for branches/version-2_5-dev/data/class/SC_UploadFile.php
- Timestamp:
- 2010/09/22 13:23:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_5-dev/data/class/SC_UploadFile.php
r18782 r18819 137 137 138 138 // アップロードされたダウンロードファイルを保存する。 139 function makeTempDownFile( ) {139 function makeTempDownFile($keyname='down_file') { 140 140 $objErr = new SC_CheckError(); 141 141 $cnt = 0; 142 142 $arrKeyname = array_flip($this->keyname); 143 144 if(!($_FILES['down_file']['size'] > 0)) { 145 $objErr->arrErr['down_file'] = "※ " . $this->disp_name[$arrKeyname['down_file']] . "がアップロードされていません。<br />"; 143 if(!($_FILES[$keyname]['size'] > 0)) { 144 $objErr->arrErr[$keyname] = "※ " . $this->disp_name[$arrKeyname[$keyname]] . "がアップロードされていません。<br />"; 146 145 } else { 147 146 foreach($this->keyname as $val) { 148 147 // 一致したキーのファイルに情報を保存する。 149 if ($val == 'down_file') {148 if ($val == $keyname) { 150 149 // 拡張子チェック 151 $objErr->doFunc(array($this->disp_name[$cnt], 'down_file', $this->arrExt[$cnt]), array("FILE_EXT_CHECK"));150 $objErr->doFunc(array($this->disp_name[$cnt], $keyname, $this->arrExt[$cnt]), array("FILE_EXT_CHECK")); 152 151 // ファイルサイズチェック 153 $objErr->doFunc(array($this->disp_name[$cnt], 'down_file', $this->size[$cnt]), array("FILE_SIZE_CHECK"));152 $objErr->doFunc(array($this->disp_name[$cnt], $keyname, $this->size[$cnt]), array("FILE_SIZE_CHECK")); 154 153 // エラーがない場合 155 if(!isset($objErr->arrErr[ 'down_file'])) {154 if(!isset($objErr->arrErr[$keyname])) { 156 155 // 一意なファイル名を作成する。 157 156 $uniqname = date("mdHi") . "_" . uniqid("")."."; 158 $this->temp_file[$cnt] = ereg_replace("^.*\.",$uniqname, $_FILES[ 'down_file']['name']);157 $this->temp_file[$cnt] = ereg_replace("^.*\.",$uniqname, $_FILES[$keyname]['name']); 159 158 set_time_limit(0); 160 $result = copy($_FILES[ 'down_file']['tmp_name'], $this->temp_dir . $this->temp_file[$cnt]);159 $result = copy($_FILES[$keyname]['tmp_name'], $this->temp_dir . $this->temp_file[$cnt]); 161 160 GC_Utils_Ex::gfPrintLog($result." -> ". $this->temp_dir . $this->temp_file[$cnt]); 162 161 } … … 165 164 } 166 165 } 167 return $objErr->arrErr[ 'down_file'];166 return $objErr->arrErr[$keyname]; 168 167 } 169 168 … … 180 179 $this->temp_file[$cnt] = ""; 181 180 $this->save_file[$cnt] = ""; 181 } 182 $cnt++; 183 } 184 } 185 186 // 画像を削除する。 187 function deleteKikakuFile($keyname) { 188 $objImage = new SC_Image($this->temp_dir); 189 $cnt = 0; 190 foreach($this->keyname as $val) { 191 if ($val == $keyname) { 192 // 一時ファイルの場合削除する。 193 if($this->temp_file[$cnt] != "") { 194 $objImage->deleteImage($this->temp_file[$cnt], $this->temp_dir); 195 } 196 $this->temp_file[$cnt] = ""; 197 //$this->save_file[$cnt] = ""; 182 198 } 183 199 $cnt++; … … 245 261 $arrRet = array(); 246 262 foreach($this->keyname as $val) { 247 if(isset($this->temp_file[$cnt]) && $this->temp_file[$cnt] != "") {263 if(isset($this->temp_file[$cnt])) { 248 264 $arrRet["temp_" . $val] = $this->temp_file[$cnt]; 249 265 } … … 262 278 $key = "temp_" . $val; 263 279 if(isset($arrPOST[$key]) && !empty($arrPOST[$key])) { 280 $this->temp_file[$cnt] = $arrPOST[$key]; 281 } 282 $key = "save_" . $val; 283 if(isset($arrPOST[$key]) && !empty($arrPOST[$key])) { 284 $this->save_file[$cnt] = $arrPOST[$key]; 285 } 286 $cnt++; 287 } 288 } 289 290 function setHiddenKikakuFileList($arrPOST) { 291 $cnt = 0; 292 foreach($this->keyname as $val) { 293 $key = "temp_" . $val; 294 if(isset($arrPOST[$key])) { 264 295 $this->temp_file[$cnt] = $arrPOST[$key]; 265 296 } … … 331 362 return $arrRet; 332 363 } 364 function getFormKikakuDownFile() { 365 $arrRet = array(); 366 $cnt = 0; 367 foreach($this->keyname as $val) { 368 if(isset($this->temp_file[$cnt])) { 369 $arrRet[$val] = $this->temp_file[$cnt]; 370 } elseif (isset($this->save_file[$cnt]) && $this->save_file[$cnt] != "") { 371 $arrRet[$val] = $this->save_file[$cnt]; 372 } 373 $cnt++; 374 } 375 return $arrRet; 376 } 333 377 334 378 // DB保存用のファイル名配列を返す … … 361 405 if(isset($arrVal['down_realfilename']) && $arrVal['down_realfilename'] != "") { 362 406 $this->save_file[0] = $arrVal['down_realfilename']; 407 } 408 } 409 410 // DBで保存されたダウンロードファイル名をセットする(setDBDownFileと統合予定) 411 function setPostFileList($arrPost,$arrVal) { 412 $cnt = 0; 413 foreach($this->keyname as $val) { 414 if(isset($arrPost['temp_down_realfilename:' . ($cnt+1)])) { 415 $this->temp_file[$cnt] = $arrPost['temp_down_realfilename:' . ($cnt+1)]; 416 } 417 $cnt++; 363 418 } 364 419 }
Note: See TracChangeset
for help on using the changeset viewer.
