Gaufrette
Gaufrette copied to clipboard
Ftp-Adapter: No such file or directory when using write() more than once with the same path
I am using the Ftp-Adapter and try to iterate over a set of files to write them on remote. Some of the files "live" in the same directory and they should do so on the remote-server. Simplified the code looks like this:
....
/* @var \Gaufrette\Filesystem $fileSystem */
$fileSystem->write('somewhere/on/the/server/fileOne.txt', 'contentOne', true);
$fileSystem->write('somewhere/on/the/server/fileTwo.txt', 'contentTwo', true);
....
This does not work. I got the error "no such file or directory" for the second file. The first file and the directory were created fine. But the second one fails with the fatal error. What am I doing wrong?
edit: When using ftp_put it seems to be necessary to change the directory if it already exists. So after ensureDirectoryExists there should be a ftp_chdir to that directory. The fpt_chdir back to the configured root should be executed after creating the file.