Index: branches/dev/data/class/SC_UploadFile.php
===================================================================
--- branches/dev/data/class/SC_UploadFile.php	(revision 293)
+++ branches/dev/data/class/SC_UploadFile.php	(revision 14410)
@@ -7,307 +7,344 @@
 
 $SC_UPLOADFILE_DIR = realpath(dirname( __FILE__));
-require_once($SC_UPLOADFILE_DIR . "/../lib/gdthumb.php");	
+require_once($SC_UPLOADFILE_DIR . "/../lib/gdthumb.php");
+require_once($SC_UPLOADFILE_DIR . "/../include/ftp.php");
 
 /* ¥¢¥Ã¥×¥í¡¼¥É¥Õ¥¡¥¤¥ë´ÉÍý¥¯¥é¥¹ */
 class SC_UploadFile {
-	var $temp_dir;
-	var $save_dir;
-	var $keyname;	// ¥Õ¥¡¥¤¥ëinput¥¿¥°¤Îname
-	var $width;		// ²£¥µ¥¤¥º
-	var $height;	// ½Ä¥µ¥¤¥º
-	var $arrExt;	// »ØÄê¤¹¤ë³ÈÄ¥»Ò
-	var $temp_file;	// ÊÝÂ¸¤µ¤ì¤¿¥Õ¥¡¥¤¥ëÌ¾
-	var $save_file; // DB¤«¤éÆÉ¤ß½Ð¤·¤¿¥Õ¥¡¥¤¥ëÌ¾
-	var $disp_name;	// ¹àÌÜÌ¾
-	var $size;		// À©¸Â¥µ¥¤¥º
-	var $necessary; // É¬¿Ü¤Î¾ì¹ç:true
-	var $image;		// ²èÁü¤Î¾ì¹ç:true
-	
-	// ¥Õ¥¡¥¤¥ë´ÉÍý¥¯¥é¥¹
-	function SC_UploadFile($temp_dir, $save_dir) {
-		$this->temp_dir = $temp_dir;
-		$this->save_dir = $save_dir;
-		$this->file_max = 0;
-	}
-
-	// ¥Õ¥¡¥¤¥ë¾ðÊóÄÉ²Ã
-	function addFile($disp_name, $keyname, $arrExt, $size, $necessary=false, $width=0, $height=0, $image=true) {
-		$this->disp_name[] = $disp_name;
-		$this->keyname[] = $keyname;
-		$this->width[] = $width;
-		$this->height[] = $height;
-		$this->arrExt[] = $arrExt;
-		$this->size[] = $size;
-		$this->necessary[] = $necessary;
-		$this->image[] = $image;
-	}
-	// ¥µ¥à¥Í¥¤¥ë²èÁü¤ÎºîÀ®
-	function makeThumb($src_file, $width, $height) {
-		// °ì°Õ¤ÊID¤ò¼èÆÀ¤¹¤ë¡£
-		$uniqname = date("mdHi") . "_" . uniqid("");
-		
-		$dst_file = $this->temp_dir . $uniqname;
-		
-		$objThumb = new gdthumb();
-		$ret = $objThumb->Main($src_file, $width, $height, $dst_file);
-		
-		if($ret[0] != 1) {
-			// ¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸¤ÎÉ½¼¨
-			print($ret[1]);
-			exit;
-		}
-		
-		return basename($ret[1]);
-	}
-		
-	// ¥¢¥Ã¥×¥í¡¼¥É¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¤òÊÝÂ¸¤¹¤ë¡£
-	function makeTempFile($keyname, $rename = true) {
-		$objErr = new SC_CheckError();
-		$cnt = 0;
-		$arrKeyname = array_flip($this->keyname);
-		
-		if(!($_FILES[$keyname]['size'] > 0)) {
-			$objErr->arrErr[$keyname] = "¢¨ " . $this->disp_name[$arrKeyname[$keyname]] . "¤¬¥¢¥Ã¥×¥í¡¼¥É¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£<br />";
-		} else {
-			foreach($this->keyname as $val) {
-				// °ìÃ×¤·¤¿¥­¡¼¤Î¥Õ¥¡¥¤¥ë¤Ë¾ðÊó¤òÊÝÂ¸¤¹¤ë¡£
-				if ($val == $keyname) {
-					// ³ÈÄ¥»Ò¥Á¥§¥Ã¥¯
-					$objErr->doFunc(array($this->disp_name[$cnt], $keyname, $this->arrExt[$cnt]), array("FILE_EXT_CHECK"));
-					// ¥Õ¥¡¥¤¥ë¥µ¥¤¥º¥Á¥§¥Ã¥¯
-					$objErr->doFunc(array($this->disp_name[$cnt], $keyname, $this->size[$cnt]), array("FILE_SIZE_CHECK"));
-					// ¥¨¥é¡¼¤¬¤Ê¤¤¾ì¹ç
-					if(!isset($objErr->arrErr[$keyname])) {
-						// ²èÁü¥Õ¥¡¥¤¥ë¤Î¾ì¹ç
-						if($this->image[$cnt]) {
-							$this->temp_file[$cnt] = $this->makeThumb($_FILES[$keyname]['tmp_name'], $this->width[$cnt], $this->height[$cnt]);
-						// ²èÁü¥Õ¥¡¥¤¥ë°Ê³°¤Î¾ì¹ç
-						} else {
-							// °ì°Õ¤Ê¥Õ¥¡¥¤¥ëÌ¾¤òºîÀ®¤¹¤ë¡£
-							if($rename) {
-								$uniqname = date("mdHi") . "_" . uniqid("").".";
-								$this->temp_file[$cnt] = ereg_replace("^.*\.",$uniqname, $_FILES[$keyname]['name']);
-							} else {
-								$this->temp_file[$cnt] = $_FILES[$keyname]['name'];	
-							}
-							$result  = copy($_FILES[$keyname]['tmp_name'], $this->temp_dir. "/". $this->temp_file[$cnt]);
-							gfPrintLog($_FILES[$keyname]['name']." -> ".$this->temp_dir. "/". $this->temp_file[$cnt]);
-						}
-					}
-				}
-				$cnt++;
-			}
-		}
-		return $objErr->arrErr[$keyname];
-	}
-
-	// ²èÁü¤òºï½ü¤¹¤ë¡£
-	function deleteFile($keyname) {
-		$objImage = new SC_Image($this->temp_dir);
-		$cnt = 0;
-		foreach($this->keyname as $val) {
-			if ($val == $keyname) {
-				// °ì»þ¥Õ¥¡¥¤¥ë¤Î¾ì¹çºï½ü¤¹¤ë¡£
-				if($this->temp_file[$cnt] != "") {
-					$objImage->deleteImage($this->temp_file[$cnt], $this->save_dir);
-				}
-				$this->temp_file[$cnt] = "";
-				$this->save_file[$cnt] = "";
-			}
-			$cnt++;
-		}
-	}
-	
-	// °ì»þ¥Õ¥¡¥¤¥ë¥Ñ¥¹¤ò¼èÆÀ¤¹¤ë¡£
-	function getTempFilePath($keyname) {
-		$cnt = 0;
-		$filepath = "";
-		foreach($this->keyname as $val) {
-			if ($val == $keyname) {
-				if($this->temp_file[$cnt] != "") {
-					$filepath = $this->temp_dir . "/" . $this->temp_file[$cnt];
-				}
-			}
-			$cnt++;
-		}
-		return $filepath;
-	}
-	
-	// °ì»þ¥Õ¥¡¥¤¥ë¤òÊÝÂ¸¥Ç¥£¥ì¥¯¥È¥ê¤Ë°Ü¤¹
-	function moveTempFile() {
-		$cnt = 0;
-		$objImage = new SC_Image($this->temp_dir);
-		
-		foreach($this->keyname as $val) {
-			if($this->temp_file[$cnt] != "") {
-													
-				$objImage->moveTempImage($this->temp_file[$cnt], $this->save_dir);
-				// ¤¹¤Ç¤ËÊÝÂ¸¥Õ¥¡¥¤¥ë¤¬¤¢¤Ã¤¿¾ì¹ç¤Ïºï½ü¤¹¤ë¡£
-				if($this->save_file[$cnt] != "" && !ereg("^sub/", $this->save_file[$cnt])) {
-					$objImage->deleteImage($this->save_file[$cnt], $this->save_dir);
-				}
-			}
-			$cnt++;
-		}
-	}
-	
-	// HIDDENÍÑ¤Î¥Õ¥¡¥¤¥ëÌ¾ÇÛÎó¤òÊÖ¤¹
-	function getHiddenFileList() {
-		$cnt = 0;
-		foreach($this->keyname as $val) {
-			if($this->temp_file[$cnt] != "") {
-				$arrRet["temp_" . $val] = $this->temp_file[$cnt];
-			}
-			if($this->save_file[$cnt] != "") {
-				$arrRet["save_" . $val] = $this->save_file[$cnt];
-			}
-			$cnt++; 
-		}
-		return $arrRet;
-	}
-	
-	// HIDDEN¤ÇÁ÷¤é¤ì¤Æ¤­¤¿¥Õ¥¡¥¤¥ëÌ¾¤ò¼èÆÀ¤¹¤ë
-	function setHiddenFileList($arrPOST) {
-		$cnt = 0;
-		foreach($this->keyname as $val) {
-			$key = "temp_" . $val;
-			if($arrPOST[$key] != "") {
-				$this->temp_file[$cnt] = $arrPOST[$key];
-			}
-			$key = "save_" . $val;
-			if($arrPOST[$key] != "") {
-				$this->save_file[$cnt] = $arrPOST[$key];
-			}
-			$cnt++;
-		}
-	}
-	
-	// ¥Õ¥©¡¼¥à¤ËÅÏ¤¹ÍÑ¤Î¥Õ¥¡¥¤¥ë¾ðÊóÇÛÎó¤òÊÖ¤¹
-	function getFormFileList($temp_url, $save_url, $real_size = false) {
-
-		$cnt = 0;
-		foreach($this->keyname as $val) {
-			if($this->temp_file[$cnt] != "") {
-				// ¥Õ¥¡¥¤¥ë¥Ñ¥¹¥Á¥§¥Ã¥¯(¥Ñ¥¹¤Î¥¹¥é¥Ã¥·¥å/¤¬Ï¢Â³¤·¤Ê¤¤¤è¤¦¤Ë¤¹¤ë¡£)
-				if(ereg("/$", $temp_url)) {
-					$arrRet[$val]['filepath'] = $temp_url . $this->temp_file[$cnt];
-				} else {
-					$arrRet[$val]['filepath'] = $temp_url . "/" . $this->temp_file[$cnt];
-				}
-				$arrRet[$val]['real_filepath'] = $this->temp_dir . $this->temp_file[$cnt];
-			} elseif ($this->save_file[$cnt] != "") {
-				// ¥Õ¥¡¥¤¥ë¥Ñ¥¹¥Á¥§¥Ã¥¯(¥Ñ¥¹¤Î¥¹¥é¥Ã¥·¥å/¤¬Ï¢Â³¤·¤Ê¤¤¤è¤¦¤Ë¤¹¤ë¡£)
-				if(ereg("/$", $save_url)) {
-					$arrRet[$val]['filepath'] = $save_url . $this->save_file[$cnt];
-				} else {
-					$arrRet[$val]['filepath'] = $save_url . "/" . $this->save_file[$cnt];
-				}
-				$arrRet[$val]['real_filepath'] = $this->save_dir . $this->save_file[$cnt];
-			}
-			if($arrRet[$val]['filepath'] != "") {
-				if($real_size){
-					if(is_file($arrRet[$val]['real_filepath'])) {
-						list($width, $height) = getimagesize($arrRet[$val]['real_filepath']);
-					}
-					// ¥Õ¥¡¥¤¥ë²£Éý
-					$arrRet[$val]['width'] = $width;
-					// ¥Õ¥¡¥¤¥ë½ÄÉý
-					$arrRet[$val]['height'] = $height;
-				}else{
-					// ¥Õ¥¡¥¤¥ë²£Éý
-					$arrRet[$val]['width'] = $this->width[$cnt];
-					// ¥Õ¥¡¥¤¥ë½ÄÉý
-					$arrRet[$val]['height'] = $this->height[$cnt];
-				}
-				// É½¼¨Ì¾
-				$arrRet[$val]['disp_name'] = $this->disp_name[$cnt];
-			}
-			$cnt++;
-		}
-		return $arrRet;
-	}
-	
-	// DBÊÝÂ¸ÍÑ¤Î¥Õ¥¡¥¤¥ëÌ¾ÇÛÎó¤òÊÖ¤¹
-	function getDBFileList() {
-		$cnt = 0;
-		foreach($this->keyname as $val) {
-			if($this->temp_file[$cnt] != "") {
-				$arrRet[$val] = $this->temp_file[$cnt];
-			} else  {
-				$arrRet[$val] = $this->save_file[$cnt];
-			}
-			$cnt++;
-		}
-		return $arrRet;
-	}
-	
-	// DB¤ÇÊÝÂ¸¤µ¤ì¤¿¥Õ¥¡¥¤¥ëÌ¾ÇÛÎó¤ò¥»¥Ã¥È¤¹¤ë
-	function setDBFileList($arrVal) {
-		$cnt = 0;
-		foreach($this->keyname as $val) {
-			if($arrVal[$val] != "") {
-				$this->save_file[$cnt] = $arrVal[$val];
-			}
-			$cnt++; 
-		}
-	}
-	
-	// ²èÁü¤ò¥»¥Ã¥È¤¹¤ë
-	function setDBImageList($arrVal) {
-		$cnt = 0;
-		foreach($this->keyname as $val) {
-			if($arrVal[$val] != "" && $val == 'tv_products_image') {
-				$this->save_file[$cnt] = $arrVal[$val];
-			}
-			$cnt++; 
-		}
-	}
-	
-	// DB¾å¤Î¥Õ¥¡¥¤¥ë¤ÎÆâºï½üÍ×µá¤¬¤¢¤Ã¤¿¥Õ¥¡¥¤¥ë¤òºï½ü¤¹¤ë¡£ 
-	function deleteDBFile($arrVal) {
-		$objImage = new SC_Image($this->temp_dir);
-		$cnt = 0;
-		foreach($this->keyname as $val) {
-			if($arrVal[$val] != "") {
-				if($this->save_file[$cnt] == "" && !ereg("^sub/", $arrVal[$val])) {
-					$objImage->deleteImage($arrVal[$val], $this->save_dir);
-				}
-			}
-			$cnt++; 
-		}
-	}
-	
-	// É¬¿ÜÈ½Äê
-	function checkEXISTS($keyname = "") {
-		$cnt = 0;
-		$arrRet = array();
-		foreach($this->keyname as $val) {
-			if($val == $keyname || $keyname == "") {
-				// É¬¿Ü¤Ç¤¢¤ì¤Ð¥¨¥é¡¼¥Á¥§¥Ã¥¯
-				if ($this->necessary[$cnt] == true) {
-					if($this->save_file[$cnt] == "" && $this->temp_file[$cnt] == "") {
-						$arrRet[$val] = "¢¨ " . $this->disp_name[$cnt] . "¤¬¥¢¥Ã¥×¥í¡¼¥É¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£<br>";
-					}
-				}
-			}
-			$cnt++;
-		}
-		return $arrRet;
-	}
-		
-	// ³ÈÂçÎ¨¤ò»ØÄê¤·¤Æ²èÁüÊÝÂ¸
-	function saveResizeImage($keyname, $to_w, $to_h) {
-		$path = "";
-		
-		// keyname¤ÎÅºÉÕ¥Õ¥¡¥¤¥ë¤ò¼èÆÀ
-		$arrImageKey = array_flip($this->keyname);
-		$file = $this->temp_file[$arrImageKey[$keyname]];
-		$filepath = $this->temp_dir . $file;
-		
-		$path = $this->makeThumb($filepath, $to_w, $to_h);
-		
-		// ¥Õ¥¡¥¤¥ëÌ¾¤À¤±ÊÖ¤¹
-		return basename($path);
-	}
+    var $temp_dir;                  // °ì»þ¥Õ¥¡¥¤¥ëÊÝÂ¸¥Ç¥£¥ì¥¯¥È¥ê
+    var $save_dir;                  // ¥Õ¥¡¥¤¥ëÊÝÂ¸¥Ç¥£¥ì¥¯¥È
+    var $ftp_dir;                   // FTPÀè¥Ç¥£¥ì¥¯¥È¥ê(Éé²ÙÊ¬»¶»þ»ÈÍÑ)
+    var $multi_web_server_mode;     // Éé²ÙÊ¬»¶¥Õ¥é¥°(Éé²ÙÊ¬»¶»þ»ÈÍÑ)
+    var $keyname;                   // ¥Õ¥¡¥¤¥ëinput¥¿¥°¤Îname
+    var $width;                     // ²£¥µ¥¤¥º
+    var $height;                    // ½Ä¥µ¥¤¥º
+    var $arrExt;                    // »ØÄê¤¹¤ë³ÈÄ¥»Ò
+    var $temp_file;                 // ÊÝÂ¸¤µ¤ì¤¿¥Õ¥¡¥¤¥ëÌ¾
+    var $save_file;                 // DB¤«¤éÆÉ¤ß½Ð¤·¤¿¥Õ¥¡¥¤¥ëÌ¾
+    var $disp_name;                 // ¹àÌÜÌ¾
+    var $size;                      // À©¸Â¥µ¥¤¥º
+    var $necessary;                 // É¬¿Ü¤Î¾ì¹ç:true
+    var $image;                     // ²èÁü¤Î¾ì¹ç:true
+    
+    // ¥Õ¥¡¥¤¥ë´ÉÍý¥¯¥é¥¹
+    function SC_UploadFile($temp_dir, $save_dir, $ftp_dir = "", $multi_web_server_mode = false) {
+        $this->temp_dir = $temp_dir;
+        $this->save_dir = $save_dir;
+        $this->ftp_dir = $ftp_dir;
+        $this->multi_web_server_mode = $multi_web_server_mode;
+        $this->file_max = 0;
+    }
+
+    // ¥Õ¥¡¥¤¥ë¾ðÊóÄÉ²Ã
+    function addFile($disp_name, $keyname, $arrExt, $size, $necessary=false, $width=0, $height=0, $image=true) {
+        $this->disp_name[] = $disp_name;
+        $this->keyname[] = $keyname;
+        $this->width[] = $width;
+        $this->height[] = $height;
+        $this->arrExt[] = $arrExt;
+        $this->size[] = $size;
+        $this->necessary[] = $necessary;
+        $this->image[] = $image;
+    }
+    // ¥µ¥à¥Í¥¤¥ë²èÁü¤ÎºîÀ®
+    function makeThumb($src_file, $width, $height) {
+        // °ì°Õ¤ÊID¤ò¼èÆÀ¤¹¤ë¡£
+        $uniqname = date("mdHi") . "_" . uniqid("");
+        
+        $objThumb = new gdthumb();
+        
+        // WEB¥µ¡¼¥ÐÉé²ÙÊ¬»¶´Ä¶­¤Î¾ì¹ç
+        if($this->multi_web_server_mode === true) {
+            // FTPÍÑ¥Õ¥¡¥¤¥ë°ì»þ³ÊÇ¼ÍÑ¥Ç¥£¥ì¥¯¥È¥ê
+            $ftp_temp_dir = $this->temp_dir . "/ftp";
+            // ¥Ç¥£¥ì¥¯¥È¥ê¤¬Â¸ºß¤·¤Ê¤«¤Ã¤¿¤éºîÀ®
+            if(!file_exists($ftp_temp_dir)) {
+                mkdir($ftp_temp_dir);
+            }
+            
+            $dst_file = $ftp_temp_dir . $uniqname;
+            $ret = $objThumb->Main($src_file, $width, $height, $dst_file);
+            ftpMoveFile($this->ftp_dir, $ret[1]);
+        } else {
+            $dst_file = $this->temp_dir . $uniqname;
+            $ret = $objThumb->Main($src_file, $width, $height, $dst_file);          
+        }
+        
+        if($ret[0] != 1) {
+            // ¥¨¥é¡¼¥á¥Ã¥»¡¼¥¸¤ÎÉ½¼¨
+            print($ret[1]);
+            exit;
+        }
+        
+        return basename($ret[1]);
+    }
+        
+    // ¥¢¥Ã¥×¥í¡¼¥É¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¤òÊÝÂ¸¤¹¤ë¡£
+    function makeTempFile($keyname, $rename = true) {
+        $objErr = new SC_CheckError();
+        $cnt = 0;
+        $arrKeyname = array_flip($this->keyname);
+        
+        if(!($_FILES[$keyname]['size'] > 0)) {
+            $objErr->arrErr[$keyname] = "¢¨ " . $this->disp_name[$arrKeyname[$keyname]] . "¤¬¥¢¥Ã¥×¥í¡¼¥É¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£<br />";
+        } else {
+            foreach($this->keyname as $val) {
+                // °ìÃ×¤·¤¿¥­¡¼¤Î¥Õ¥¡¥¤¥ë¤Ë¾ðÊó¤òÊÝÂ¸¤¹¤ë¡£
+                if ($val == $keyname) {
+                    // ³ÈÄ¥»Ò¥Á¥§¥Ã¥¯
+                    $objErr->doFunc(array($this->disp_name[$cnt], $keyname, $this->arrExt[$cnt]), array("FILE_EXT_CHECK"));
+                    // ¥Õ¥¡¥¤¥ë¥µ¥¤¥º¥Á¥§¥Ã¥¯
+                    $objErr->doFunc(array($this->disp_name[$cnt], $keyname, $this->size[$cnt]), array("FILE_SIZE_CHECK"));
+                    // ¥¨¥é¡¼¤¬¤Ê¤¤¾ì¹ç
+                    if(!isset($objErr->arrErr[$keyname])) {
+                        // ²èÁü¥Õ¥¡¥¤¥ë¤Î¾ì¹ç
+                        if($this->image[$cnt]) {
+                            $this->temp_file[$cnt] = $this->makeThumb($_FILES[$keyname]['tmp_name'], $this->width[$cnt], $this->height[$cnt]);
+                        // ²èÁü¥Õ¥¡¥¤¥ë°Ê³°¤Î¾ì¹ç
+                        } else {
+                            // °ì°Õ¤Ê¥Õ¥¡¥¤¥ëÌ¾¤òºîÀ®¤¹¤ë¡£
+                            if($rename) {
+                                $uniqname = date("mdHi") . "_" . uniqid("").".";
+                                $this->temp_file[$cnt] = ereg_replace("^.*\.",$uniqname, $_FILES[$keyname]['name']);
+                            } else {
+                                $this->temp_file[$cnt] = $_FILES[$keyname]['name'];    
+                            }
+                            $result  = copy($_FILES[$keyname]['tmp_name'], $this->temp_dir. "/". $this->temp_file[$cnt]);
+                            gfPrintLog($_FILES[$keyname]['name']." -> ".$this->temp_dir. "/". $this->temp_file[$cnt]);
+                        }
+                    }
+                }
+                $cnt++;
+            }
+        }
+        return $objErr->arrErr[$keyname];
+    }
+
+    // ²èÁü¤òºï½ü¤¹¤ë¡£
+    function deleteFile($keyname) {
+        $objImage = new SC_Image($this->temp_dir);
+        $cnt = 0;
+        foreach($this->keyname as $val) {
+            if ($val == $keyname) {
+                // °ì»þ¥Õ¥¡¥¤¥ë¤Î¾ì¹çºï½ü¤¹¤ë¡£
+                if($this->temp_file[$cnt] != "") {
+                    $objImage->deleteImage($this->temp_file[$cnt], $this->save_dir);
+                }
+                $this->temp_file[$cnt] = "";
+                $this->save_file[$cnt] = "";
+            }
+            $cnt++;
+        }
+    }
+    
+    // °ì»þ¥Õ¥¡¥¤¥ë¥Ñ¥¹¤ò¼èÆÀ¤¹¤ë¡£
+    function getTempFilePath($keyname) {
+        $cnt = 0;
+        $filepath = "";
+        foreach($this->keyname as $val) {
+            if ($val == $keyname) {
+                if($this->temp_file[$cnt] != "") {
+                    $filepath = $this->temp_dir . "/" . $this->temp_file[$cnt];
+                }
+            }
+            $cnt++;
+        }
+        return $filepath;
+    }
+    
+    // °ì»þ¥Õ¥¡¥¤¥ë¤òÊÝÂ¸¥Ç¥£¥ì¥¯¥È¥ê¤Ë°Ü¤¹
+    function moveTempFile() {
+        $cnt = 0;
+        $objImage = new SC_Image($this->temp_dir);
+        
+        foreach($this->keyname as $val) {
+            if($this->temp_file[$cnt] != "") {
+                                                    
+                $objImage->moveTempImage($this->temp_file[$cnt], $this->save_dir);
+                // ¤¹¤Ç¤ËÊÝÂ¸¥Õ¥¡¥¤¥ë¤¬¤¢¤Ã¤¿¾ì¹ç¤Ïºï½ü¤¹¤ë¡£
+                if($this->save_file[$cnt] != "" && !ereg("^sub/", $this->save_file[$cnt])) {
+                    $objImage->deleteImage($this->save_file[$cnt], $this->save_dir);
+                }
+            }
+            $cnt++;
+        }
+    }
+    
+    // HIDDENÍÑ¤Î¥Õ¥¡¥¤¥ëÌ¾ÇÛÎó¤òÊÖ¤¹
+    function getHiddenFileList() {
+        $cnt = 0;
+        foreach($this->keyname as $val) {
+            if($this->temp_file[$cnt] != "") {
+                $arrRet["temp_" . $val] = $this->temp_file[$cnt];
+            }
+            if($this->save_file[$cnt] != "") {
+                $arrRet["save_" . $val] = $this->save_file[$cnt];
+            }
+            $cnt++; 
+        }
+        return $arrRet;
+    }
+    
+    // HIDDEN¤ÇÁ÷¤é¤ì¤Æ¤­¤¿¥Õ¥¡¥¤¥ëÌ¾¤ò¼èÆÀ¤¹¤ë
+    function setHiddenFileList($arrPOST) {
+        $cnt = 0;
+        foreach($this->keyname as $val) {
+            $key = "temp_" . $val;
+            if($arrPOST[$key] != "") {
+                $this->temp_file[$cnt] = $arrPOST[$key];
+            }
+            $key = "save_" . $val;
+            if($arrPOST[$key] != "") {
+                $this->save_file[$cnt] = $arrPOST[$key];
+            }
+            $cnt++;
+        }
+    }
+    
+    // ¥Õ¥©¡¼¥à¤ËÅÏ¤¹ÍÑ¤Î¥Õ¥¡¥¤¥ë¾ðÊóÇÛÎó¤òÊÖ¤¹
+    function getFormFileList($temp_url, $save_url, $real_size = false) {
+
+        $cnt = 0;
+        foreach($this->keyname as $val) {
+            if($this->temp_file[$cnt] != "") {
+                // ¥Õ¥¡¥¤¥ë¥Ñ¥¹¥Á¥§¥Ã¥¯(¥Ñ¥¹¤Î¥¹¥é¥Ã¥·¥å/¤¬Ï¢Â³¤·¤Ê¤¤¤è¤¦¤Ë¤¹¤ë¡£)
+                if(ereg("/$", $temp_url)) {
+                    $arrRet[$val]['filepath'] = $temp_url . $this->temp_file[$cnt];
+                } else {
+                    $arrRet[$val]['filepath'] = $temp_url . "/" . $this->temp_file[$cnt];
+                }
+                $arrRet[$val]['real_filepath'] = $this->temp_dir . $this->temp_file[$cnt];
+            } elseif ($this->save_file[$cnt] != "") {
+                // ¥Õ¥¡¥¤¥ë¥Ñ¥¹¥Á¥§¥Ã¥¯(¥Ñ¥¹¤Î¥¹¥é¥Ã¥·¥å/¤¬Ï¢Â³¤·¤Ê¤¤¤è¤¦¤Ë¤¹¤ë¡£)
+                if(ereg("/$", $save_url)) {
+                    $arrRet[$val]['filepath'] = $save_url . $this->save_file[$cnt];
+                } else {
+                    $arrRet[$val]['filepath'] = $save_url . "/" . $this->save_file[$cnt];
+                }
+                $arrRet[$val]['real_filepath'] = $this->save_dir . $this->save_file[$cnt];
+            }
+            if($arrRet[$val]['filepath'] != "") {
+                if($real_size){
+                    if(is_file($arrRet[$val]['real_filepath'])) {
+                        list($width, $height) = getimagesize($arrRet[$val]['real_filepath']);
+                    }
+                    // ¥Õ¥¡¥¤¥ë²£Éý
+                    $arrRet[$val]['width'] = $width;
+                    // ¥Õ¥¡¥¤¥ë½ÄÉý
+                    $arrRet[$val]['height'] = $height;
+                }else{
+                    // ¥Õ¥¡¥¤¥ë²£Éý
+                    $arrRet[$val]['width'] = $this->width[$cnt];
+                    // ¥Õ¥¡¥¤¥ë½ÄÉý
+                    $arrRet[$val]['height'] = $this->height[$cnt];
+                }
+                // É½¼¨Ì¾
+                $arrRet[$val]['disp_name'] = $this->disp_name[$cnt];
+            }
+            $cnt++;
+        }
+        return $arrRet;
+    }
+    
+    // DBÊÝÂ¸ÍÑ¤Î¥Õ¥¡¥¤¥ëÌ¾ÇÛÎó¤òÊÖ¤¹
+    function getDBFileList() {
+        $cnt = 0;
+        foreach($this->keyname as $val) {
+            if($this->temp_file[$cnt] != "") {
+                $arrRet[$val] = $this->temp_file[$cnt];
+            } else  {
+                $arrRet[$val] = $this->save_file[$cnt];
+            }
+            $cnt++;
+        }
+        return $arrRet;
+    }
+    
+    // DB¤ÇÊÝÂ¸¤µ¤ì¤¿¥Õ¥¡¥¤¥ëÌ¾ÇÛÎó¤ò¥»¥Ã¥È¤¹¤ë
+    function setDBFileList($arrVal) {
+        $cnt = 0;
+        foreach($this->keyname as $val) {
+            if($arrVal[$val] != "") {
+                $this->save_file[$cnt] = $arrVal[$val];
+            }
+            $cnt++; 
+        }
+    }
+    
+    // ²èÁü¤ò¥»¥Ã¥È¤¹¤ë
+    function setDBImageList($arrVal) {
+        $cnt = 0;
+        foreach($this->keyname as $val) {
+            if($arrVal[$val] != "" && $val == 'tv_products_image') {
+                $this->save_file[$cnt] = $arrVal[$val];
+            }
+            $cnt++; 
+        }
+    }
+    
+    // DB¾å¤Î¥Õ¥¡¥¤¥ë¤ÎÆâºï½üÍ×µá¤¬¤¢¤Ã¤¿¥Õ¥¡¥¤¥ë¤òºï½ü¤¹¤ë¡£ 
+    function deleteDBFile($arrVal) {
+        $objImage = new SC_Image($this->temp_dir);
+        $cnt = 0;
+        foreach($this->keyname as $val) {
+            if($arrVal[$val] != "") {
+                if($this->save_file[$cnt] == "" && !ereg("^sub/", $arrVal[$val])) {
+                    $objImage->deleteImage($arrVal[$val], $this->save_dir);
+                }
+            }
+            $cnt++; 
+        }
+    }
+    
+    // É¬¿ÜÈ½Äê
+    function checkEXISTS($keyname = "") {
+        $cnt = 0;
+        $arrRet = array();
+        foreach($this->keyname as $val) {
+            if($val == $keyname || $keyname == "") {
+                // É¬¿Ü¤Ç¤¢¤ì¤Ð¥¨¥é¡¼¥Á¥§¥Ã¥¯
+                if ($this->necessary[$cnt] == true) {
+                    if($this->save_file[$cnt] == "" && $this->temp_file[$cnt] == "") {
+                        $arrRet[$val] = "¢¨ " . $this->disp_name[$cnt] . "¤¬¥¢¥Ã¥×¥í¡¼¥É¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£<br>";
+                    }
+                }
+            }
+            $cnt++;
+        }
+        return $arrRet;
+    }
+        
+    // ³ÈÂçÎ¨¤ò»ØÄê¤·¤Æ²èÁüÊÝÂ¸
+    function saveResizeImage($keyname, $to_w, $to_h) {
+        $path = "";
+        
+        // keyname¤ÎÅºÉÕ¥Õ¥¡¥¤¥ë¤ò¼èÆÀ
+        $arrImageKey = array_flip($this->keyname);
+        $file = $this->temp_file[$arrImageKey[$keyname]];
+        $filepath = $this->temp_dir . $file;
+        
+        $path = $this->makeThumb($filepath, $to_w, $to_h);
+        
+        // ¥Õ¥¡¥¤¥ëÌ¾¤À¤±ÊÖ¤¹
+        return basename($path);
+    }
+
+    /**         
+     * ¥Õ¥¡¥¤¥ë¤òÁ´¤Æ¤ÎWEB¥µ¡¼¥Ð¤Ø¥³¥Ô¡¼¤·¤Þ¤¹¡£
+     *
+     * @param string $dst_path ¥³¥Ô¡¼Àè¥Õ¥¡¥¤¥ë¥Ñ¥¹(ÁêÂÐ¥Ñ¥¹)
+     * @param string $src_path ¥³¥Ô¡¼¸µ¥Õ¥¡¥¤¥ë¥Ñ¥¹(ÀäÂÐ¥Ñ¥¹)
+     * @return void
+     */
+    function ftpMoveFile($dst_path, $src_path) {
+        global $arrWEB_SERVERS;
+
+        // Á´¤Æ¤Î¥µ¡¼¥Ð¤Ë¥Õ¥¡¥¤¥ë¤ò¥³¥Ô¡¼¤¹¤ë
+        foreach($arrWEB_SERVERS as $array) {
+            sfFtpCopy($array['host'], $array['user'], $array['pass'], $dst_path, $src_path);            
+        }
+        // °ÜÆ°¸å¤Ï¥Õ¥¡¥¤¥ë¤òºï½ü
+        unlink($src_path);
+    }
 }
 ?>
