downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

SSL bağlamı seçenekleri> <HTTP bağlamı seçenekleri
[edit] Last updated: Fri, 23 Mar 2012

view this page in

FTP bağlamı seçenekleri

FTP bağlamı seçenekleriFTP bağlamı seçeneklerinin listesi

Açıklama

ftp:// ve ftps:// aktarımları için bağlamsal seçenekler.

Seçenekler

overwrite boolean

Uzak sunucuda mevcut dosyaların üzerine yazılmasına izin verir. Sadece yazma kipine (dosya gönderme) uygulanır.

FALSE öntanımlıdır.

resume_pos integer

Aktarımın başlatılacağı dosya konumu. Sadece okuma kipine (indirme) uygulanır.

0 (dosyanın başlangıcı) öntanımlıdır.

proxy string

HTTP vekil sunucu üzerinden vekil FTP isteği. Sadece dosya okuma işlemlerine uygulanır. Örnek: tcp://vekil.mesela.dom:8000.

Sürüm Bilgisi

Sürüm: Açıklama
5.1.0 proxy eklendi.
5.0.0 overwrite ve resume_pos eklendi.

Notlar

Bilginize: Temel soket akımı bağlamı seçenekleri
Ek bağlamsal seçenekler temel aktarım tarafından desteklenebilir. ftp://akımları için tcp:// aktarımının bağlamsal seçeneklerine atıf yapılır. ftps:// akımları için ise ssl:// aktarımının bağlamsal seçeneklerine atıf yapılır.



add a note add a note User Contributed Notes FTP bağlamı seçenekleri
php dot net at misterchucker dot com 16-Apr-2009 03:19
This is an example of how to allow fopen() to overwrite a file on an FTP site. If the stream context is not modified, an error will occur: "...failed to open stream: Remote file already exists and overwrite context option not specified...".

<?php
// The path to the FTP file, including login arguments
$ftp_path = 'ftp://username:password@example.com/example.txt';

// Allows overwriting of existing files on the remote FTP server
$stream_options = array('ftp' => array('overwrite' => true));

// Creates a stream context resource with the defined options
$stream_context = stream_context_create($stream_options);

// Opens the file for writing and truncates it to zero length
if ($fh = fopen($ftp_path, 'w', 0, $stream_context))
{
   
// Writes contents to the file
   
fputs($fh, 'example contents');
   
   
// Closes the file handle
   
fclose($fh);
}
else
{
    die(
'Could not open file.');
}
?>

 
show source | credits | stats | sitemap | contact | advertising | mirror sites