PHP 8.3.4 Released!

ftp://

ftps://

ftp:// -- ftps://FTP'lere Erişim

Açıklama

FTP üzerinden mevcut dosyaların okunmasına, yeni dosyaların oluşturulmasına erişim sağlar. Sunucu edilgen kip FTP'yi desteklemiyorsa bağlantı başarısız olur.

Dosyaları okumak veya yazmak için açabilirsiniz ama ikisini aynı anda yapamazsınız. Uzak dosya, ftp sunucusunda zaten mevcutsa ve üzerine yazmak için açmaya çalışırsanız ancak bağlama overwrite seçeneğini belirtmezseniz, bağlantı başarısız olur. FTP üzerinden mevcut dosyaların üzerine yazmanız gerekiyorsa, bağlamda overwrite seçeneğini belirtin ve dosyayı yazmak için açın. Diğer bir yöntem, FTP eklentisini kullanmaktır.

php.ini'de from yönergesine atadığınız bir parola varsa anonim FTP parolası olarak gönderilecektir.

Kullanımı

  • ftp://example.com/pub/dosya.txt
  • ftp://kullanıcı:parola@example.com/pub/dosya.txt
  • ftps://example.com/pub/dosya.txt
  • ftps://kullanıcı:parola@example.com/pub/dosya.txt

Seçenekler

Sarmalayıcı Özeti
Özellik Destek
allow_url_fopen ile sınırlı Evet
Okuma izni Evet
Yazma izni Evet(yeni dosyalar; mevcut dosyalar için overwrite ile)
Ekleme izni Evet
Aynı anda okuma ve yazma izni Hayır
stat() desteği Sadece filesize(), filemtime(), filetype(), file_exists(), is_file() ve is_dir() için.
unlink() desteği Evet
rename() desteği Evet
mkdir() desteği Evet
rmdir() desteği Evet

Notlar

Bilginize:

FTPS sadece openssl eklentisi etkinse desteklenir.

Sunucuda SSL desteği yoksa, bağlantı sıradan şifresiz ftp'ye dönüşür.

Bilginize: Ekleme
Dosyalara ftp:// URL sarmalayıcısı üzerinden ekleme yapılabilir.

Ayrıca Bakınız

add a note

User Contributed Notes 3 notes

up
-8
php at f00n dot com
19 years ago
For Intranet purposes I found I preferred to move my file via ftp functions to match the session user's ftp account and put the file in a holding bay so I knew who it was from.

The FTP wrapper method will NOT do this if your ftp server does NOT support passive mode.

eg. an ftp server behind NAT/routing
up
-14
Anonymous
18 years ago
<?
$str ="replace all contenents";
$filew="ftp://gufo:gufo@192.168.1.55:21/jj.php";
$opts = array('ftp' => array('overwrite' => true));
$context = stream_context_create($opts);
$strwri = file_put_contents($filew,$str,LOCK_EX,$context);
?>
up
-15
fazil dot stormhammer dot nospam at gmail dot com
15 years ago
Document says "Allows read access to existing files and creation of new files via FTP. If the server does not support passive mode ftp, the connection will fail. "

As of version 5.2.5 at least fopen("ftp://...") uses an ACTIVE mode connection by default (it issues an FTP PORT command but not a PASV command). To force passive mode:

$f = fopen("ftp://...");
ftp_pasv($f, true);
To Top