看板 PHP 關於我們 聯絡資訊
以下是我的程式 但是還是會有 failed to open stream: FTP server reports 550 No such file or directory 這個錯誤在 ...但是我把$redir貼到網址列卻正確的可以下載檔案 我這樣寫有錯嗎@@? <?php $redir="ftp://id:pw@ip/filename"; header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: application/force-download"); header("Content-Disposition: attachment;filename=\"$filename\""); header("Content-Transfer-Encoding: binary"); readfile_chunked2($redir); function readfile_chunked2($filename) { $chunksize = 1*(1024*1024); // how many bytes per chunk $buffer = ''; $handle = fopen($filename, 'rb'); if ($handle === false) { return false; } while (!feof($handle)) { $buffer = fread($handle, $chunksize); print $buffer; } return fclose($handle); } ?> -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 218.170.133.31 ※ 編輯: prelight 來自: 218.170.133.31 (10/14 06:33)
qrtt1:請問是什麼理由不能使用ftp function @@? 10/14 06:45
prelight:沒有阿 就是想試試看這樣行不行 有人可以嗎orz 10/14 14:38
prelight:我一直跑出550錯誤 可是路徑應該對阿 10/14 14:38
prelight:請問一下國外php論壇比較好的有哪些阿 我想去那邊問問 10/14 14:43
taiwancat:對不起...這裡的不夠好 我對不起大家╭(─╴╴─)╮ 10/14 17:56
qrtt1:550 是沒有使用權限。猜測可能無法直接建立連線而你的 10/14 20:54
qrtt1:fopen又不會自動轉成PASV模式導致的吧 10/14 20:55
qrtt1:不過怎麼看都覺得奇怪就是了。ftp明明要二條線路去達成實作 10/14 20:56
qrtt1:想用一個fopen搞定,實在是.... 10/14 20:56
taiwancat:ftp是對話式的通訊協定...這樣搞可以? 10/14 21:18