[Filesystem] Add FTP stream wrapper context option to enable overwrite (override)

This commit is contained in:
Damian Sromek 2014-08-26 13:48:14 +02:00 committed by Fabien Potencier
parent 2c9496bc77
commit c056a9c426

View File

@ -50,7 +50,8 @@ class Filesystem
if ($doCopy) { if ($doCopy) {
// https://bugs.php.net/bug.php?id=64634 // https://bugs.php.net/bug.php?id=64634
$source = fopen($originFile, 'r'); $source = fopen($originFile, 'r');
$target = fopen($targetFile, 'w'); // Stream context created to allow files overwrite when using FTP stream wrapper - disabled by default
$target = fopen($targetFile, 'w', null, stream_context_create(array('ftp' => array('overwrite' => true))));
stream_copy_to_stream($source, $target); stream_copy_to_stream($source, $target);
fclose($source); fclose($source);
fclose($target); fclose($target);