[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
1 changed files with 2 additions and 1 deletions

View File

@ -50,7 +50,8 @@ class Filesystem
if ($doCopy) {
// https://bugs.php.net/bug.php?id=64634
$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);
fclose($source);
fclose($target);