1

Im using Gaufrette to fetch PDF files over FTP

knp_gaufrette:
  adapters:
    invoice_ftp:
      ftp:
        host: ftp.localhost
        port: 21
  filesystems:
    invoice:
      adapter: invoice_ftp

And Im downloading the file with

$url = sprintf('upload/%s/%s.%s', $this->getFolderName($file), $file, $extension);
$file = $this->filesystem->get($url);
$content = $file->getContent();
file_put_contents($newfile, $content);

But this gives me a error in the PDF file

But if im using

$url = sprintf('ftp://ftp.localhost/upload/%s/%s', $this->getFolderName($filename), $filename . '.PDF');
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$content = curl_exec($ch);
file_put_contents($newfile, $content);

Is this a bug in gaufrette, or am I using gaufrette wrong? I heard something about its maybe trying to use binary mode in gaufrette instead of ascii mode, but I dont know how to change this

4

1 回答 1

1

通过将我的适配器从mode FTP_ASCII(默认)更改为FTP_BINARY它就像一个魅力。

knp_gaufrette:
  adapters:
    invoice_ftp:
      ftp:
        host: ftp.localhost
        port: 21
        mode: FTP_BINARY
于 2015-03-28T12:35:33.490 回答