1

ルートからファイルを取得すると機能しますが、フォルダーからファイルを取得したい場合は失敗しますが、「ファイルは正常にダウンロードされました」と表示されます。

ここにコードがあります

$sourcefile = "test.doc";
$local_file = $_SERVER['DOCUMENT_ROOT'] . "/sites/default/files/" . "answerdoc" . $node->nid . $sourcefile; 
$remote_file = "test.doc";
$currPath = "documents";        


if (@ftp_login($conn_id, FTP_USER, FTP_PASS)) {

    // it works
    ftp_pasv($conn_id, true);               

    if (ftp_get($conn_id, $local_file , $remote_file, FTP_BINARY)) {
        drupal_set_message(t('file downloaded successfully'));
    } else {
        drupal_set_message(t('there was error'));
    }


    if(@ftp_chdir($conn_id,$currPath)){

        $answerdir ="Answer";
        // it does not work but shows "file downloaded successfully"
        if(@ftp_chdir($conn_id,$answerdir)) {   

            ftp_pasv($conn_id, true);

            if (ftp_get($conn_id, $local_file, $remote_file, FTP_BINARY)) {
                drupal_set_message(t('file downloaded successfully'));
            } else {
                drupal_set_message(t('there was error'));
            }


        }
    }
}

編集済み

4

1 に答える 1

2
  1. まず、関数呼び出しから「@」を削除します。
  2. 次に、エラー報告が E_ALL に設定されていることを確認してください。

    error_reporting(E_ALL);
    
  3. ブラウザーの出力と Web サーバーのエラー ログを調べます。

これは、トラブルシューティングに役立つはずです。

于 2012-10-11T14:55:09.590 に答える