コード例 #1
0
ファイル: upload.php プロジェクト: iwarsong/NCMI
 public function safetyUpload()
 {
     $ret = $this->upload();
     if ($ret == "success") {
         if (nt_check) {
             $f = new FTP(FTP_URL, FTP_USER, UPLOAD_PASSWORD, UPLOAD_DIR);
             if ($f->status == 1) {
                 $f->put($this->folder . $this->name, $this->name);
                 $i = 0;
                 $has = false;
                 while ($i < UPLOAD_TRY_TIME) {
                     sleep(UPLOAD_TRY_INTERVAL);
                     if ($f->isFile($this->name)) {
                         $has = true;
                         //echo $f->unlink($this->name);
                     }
                     $i++;
                 }
                 $f->bye();
                 if ($has) {
                     return "success";
                 } else {
                     return "not saft";
                 }
             } else {
                 unlink($this->folder . $this->name);
                 return "ftp_unconnect";
             }
         } else {
             return $ret;
         }
     } else {
         return $ret;
     }
 }