Changeset 18777 for branches/version-2_5-dev/data/class/SC_UploadFile.php
- Timestamp:
- 2010/08/06 14:52:59 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_5-dev/data/class/SC_UploadFile.php
r18701 r18777 136 136 } 137 137 138 // アップロードされたダウンロードファイルを保存する。 139 function makeTempDownFile() { 140 $objErr = new SC_CheckError(); 141 $cnt = 0; 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 />"; 146 } else { 147 foreach($this->keyname as $val) { 148 // 一致したキーのファイルに情報を保存する。 149 if ($val == 'down_file') { 150 // 拡張子チェック 151 $objErr->doFunc(array($this->disp_name[$cnt], 'down_file', $this->arrExt[$cnt]), array("FILE_EXT_CHECK")); 152 // ファイルサイズチェック 153 $objErr->doFunc(array($this->disp_name[$cnt], 'down_file', $this->size[$cnt]), array("FILE_SIZE_CHECK")); 154 // エラーがない場合 155 if(!isset($objErr->arrErr['down_file'])) { 156 // 一意なファイル名を作成する。 157 $uniqname = date("mdHi") . "_" . uniqid("")."."; 158 $this->temp_file[$cnt] = ereg_replace("^.*\.",$uniqname, $_FILES['down_file']['name']); 159 set_time_limit(0); 160 $result = copy($_FILES['down_file']['tmp_name'], $this->temp_dir . $this->temp_file[$cnt]); 161 GC_Utils_Ex::gfPrintLog($result." -> ". $this->temp_dir . $this->temp_file[$cnt]); 162 } 163 } 164 $cnt++; 165 } 166 } 167 return $objErr->arrErr['down_file']; 168 } 169 138 170 // 画像を削除する。 139 171 function deleteFile($keyname) { … … 184 216 185 217 $objImage->deleteImage($this->save_file[$cnt], $this->save_dir); 218 } 219 } 220 $cnt++; 221 } 222 } 223 224 // ダウンロード一時ファイルを保存ディレクトリに移す 225 function moveTempDownFile() { 226 $cnt = 0; 227 $objImage = new SC_Image($this->temp_dir); 228 foreach($this->keyname as $val) { 229 if(isset($this->temp_file[$cnt]) && $this->temp_file[$cnt] != "") { 230 $objImage->moveTempImage($this->temp_file[$cnt], $this->save_dir); 231 // すでに保存ファイルがあった場合は削除する。 232 if(isset($this->save_file[$cnt]) 233 && $this->save_file[$cnt] != "" 234 && !ereg("^sub/", $this->save_file[$cnt])) { 235 $objImage->deleteImage($this->save_file[$cnt], $this->save_dir); 186 236 } 187 237 } … … 267 317 } 268 318 319 // フォームに渡す用のダウンロードファイル情報を返す 320 function getFormDownFile() { 321 $arrRet = ""; 322 $cnt = 0; 323 GC_Utils::gfDebugLog($this->keyname); 324 foreach($this->keyname as $val) { 325 if(isset($this->temp_file[$cnt]) && $this->temp_file[$cnt] != "") { 326 $arrRet = $this->temp_file[$cnt]; 327 } elseif (isset($this->save_file[$cnt]) && $this->save_file[$cnt] != "") { 328 $arrRet = $this->save_file[$cnt]; 329 } 330 $cnt++; 331 } 332 GC_Utils::gfPrintLog("1111111111111111111111"); 333 GC_Utils::gfDebugLog($arrRet); 334 return $arrRet; 335 } 336 269 337 // DB保存用のファイル名配列を返す 270 338 function getDBFileList() { … … 292 360 } 293 361 362 // DBで保存されたダウンロードファイル名をセットする 363 function setDBDownFile($arrVal) { 364 GC_Utils::gfPrintLog("setDBDownFile"); 365 GC_Utils::gfDebugLog($arrVal); 366 if(isset($arrVal['down_realfilename']) && $arrVal['down_realfilename'] != "") { 367 $this->save_file[0] = $arrVal['down_realfilename']; 368 } 369 } 370 294 371 // 画像をセットする 295 372 function setDBImageList($arrVal) { … … 314 391 } 315 392 $cnt++; 393 } 394 } 395 396 // DB上のダウンロードファイルの内削除要求があったファイルを削除する。 397 function deleteDBDownFile($arrVal) { 398 $objImage = new SC_Image($this->temp_dir); 399 $cnt = 0; 400 if($arrVal['down_realfilename'] != "") { 401 if($this->save_file[$cnt] == "" && !ereg("^sub/", $arrVal['down_realfilename'])) { 402 $objImage->deleteImage($arrVal['down_realfilename'], $this->save_dir); 403 } 316 404 } 317 405 }
Note: See TracChangeset
for help on using the changeset viewer.