2016-03-29 15 views
3

Ben Bu sonuçftp_delete - Belirtilen dosya var ancak bulunamadı

$connection = ftp_connect(FTP_SERVER); 
$login = ftp_login($connection, FTP_USERNAME, FTP_PASSWORD); 
if ($login) { 
    $file = "" . DOCUMENT_ROOT . "/uploaded_files/" . Session::GetSession('username') . "/" . $result['ftp_file_name'] . ""; 
    if (file_exists($file)) { 
     echo "file_exists"; 
     if (ftp_delete($connection, $file)) { 
      echo "deleted"; 
     } else { 
      echo "file_not_found"; 
     } 
    } else { 
     echo "does_not_exists"; 
    } 
} else { 
    echo "not_logged_in"; 
} 

oO .. garip sorunu ... Gördüğünüz gibi vardır: (ftp_delete:

file_exists
Uyarı): C Dosya bulunamadı: \ programy \ xampp \ htdocs \ ajax-handler.php hattında file_not_found

kimse böyle oluyor neden bana söyleyebilir misiniz? Bu hiç mantıklı ..

+1

baskı '$ Dosya 'şöyle ftp_delete denemede önce 'kısmındaki'(@) işareti ekleyin ve gerçekten eğer kontrol etmez bulunmaktadır. – Federkun

+1

Ayrıca $ dosyası bir yol .. * yerel * dosyalarının varlığını –

+2

'file_exists' kontroller olduğundan emin olun. ftp_delete, * uzak FTP sunucusunda * bir dosya siler. –

cevap

-1
$connection = ftp_connect(FTP_SERVER); 
      $login = ftp_login($connection, FTP_USERNAME, FTP_PASSWORD); 
      if ($login) { 
       $get_file=$_GET['uploaded_files']; 
       $file = "" . DOCUMENT_ROOT . "/uploaded_files/" . Session::GetSession('username') . "/" . $result['ftp_file_name'] .$get_file ""; 
       if (file_exists($file)) { 
        echo "file_exists"; 
        if (ftp_delete($connection, $file)) { 
     echo "deleted"; 
        } else { 
         echo "file_not_found"; 
        } 
       } else { 
        echo "does_not_exists"; 
       } 
      } 
     } else { 
      echo "not_logged_in"; 
     } 
ftp_close($connection); 
0

Kaldır DOCUMENT_ROOT ve

$fileTmp = "/uploaded_files/" . Session::GetSession('username') . "/" .    $result['ftp_file_name'] .$get_file ""; 

    if (@ftp_delete($connection, $fileTmp)){ 
+0

bilseydin uyarı gizlenmesi bir çözüm değildir! başarısız olursa bu uyarı .. – moopet

+0

Brata kodu, yalnızca sorunu uyarıyor bu konuda bilecek gerçek sorun dahaki sefere? çünkü ? –

+0

@ArshidKV ve ne üretecek if ve else ifadeleri. olmadığından – Pred

İlgili konular