Skip to content

[9.x] FTP file driver not properly documented and doesn't upload files (worked with v8) #40910

Closed
@dizco

Description

@dizco
  • Laravel Version: 9.0.1
  • PHP Version: 8.1
  • Database Driver & Version:

Description:

3 things all related to FTP file driver

  1. Upgrade from 8.x to 9.x should probably document the fact that the Flysystem FTP adapter must now be added manually, as mentionned in [9.x] Flysystem v2 #33612
    composer require league/flysystem-ftp
    
Error details
   Error

  Class "League\Flysystem\Ftp\FtpAdapter" not found

  at C:\Users\Gabriel\Documents\Github\dizco\laravel-template\template\vendor\laravel\framework\src\Illuminate\Filesystem\FilesystemManager.php:195
    191▕      * @return \Illuminate\Contracts\Filesystem\Filesystem
    192▕      */
    193▕     public function createFtpDriver(array $config)
    194▕     {
  ➜ 195▕         $adapter = new FtpAdapter(FtpConnectionOptions::fromArray($config));
    196▕
    197▕         return new FilesystemAdapter($this->createFlysystem($adapter, $config), $adapter, $config);
    198▕     }
    199▕

  1   C:\Users\Gabriel\Documents\Github\dizco\laravel-template\template\vendor\laravel\framework\src\Illuminate\Filesystem\FilesystemManager.php:149
      Illuminate\Filesystem\FilesystemManager::createFtpDriver(["ftp", "ftp.kiosoft.ca", "<username>", "<pwd>"])

  2   C:\Users\Gabriel\Documents\Github\dizco\laravel-template\template\vendor\laravel\framework\src\Illuminate\Filesystem\FilesystemManager.php:117
      Illuminate\Filesystem\FilesystemManager::resolve("ftp")
  1. FTP Driver configuration should also mention that the package must be installed
  2. Even after adding the package explicitly, my files are not uploading. This same code used to work for v8. See below

Steps To Reproduce:

$files = File::allFiles($screenshotsFolderPath);

if ($files) {
    foreach ($files as $file) {
        $filePath = $file->getPathname();

        $this->info("Copying file to {$filePath}@browser-test-results");
        $success = Storage::disk('browser-tests-results')
            ->put($filePath, $file->getContents());
        if (!$success) {
            $this->warn("Unable to copy file (result: {$success})");
        }
    }
}

Output:

Copying file to tests/Browser/results/localresult/endpoints___-.png@browser-tests-results
Unable to copy file (result: )
Copying file to tests/Browser/results/localresult/endpoints___-en.png@browser-tests-results
Unable to copy file (result: )

This is my file disk config:

'browser-tests-results' => [
    'driver' => 'ftp',
    'host' => env('BROWSER_TESTS_RESULTS_FTP_SERVER'),
    'username' => env('BROWSER_TESTS_RESULTS_FTP_USERNAME'),
    'password' => env('BROWSER_TESTS_RESULTS_FTP_PASSWORD'),
    'port' => 21,

    // Optional FTP Settings...
    // 'port' => 21,
    // 'root' => '',
    // 'passive' => true,
    // 'ssl' => true,
    // 'timeout' => 30,
    //'passive' => false,
    //'ignorePassiveAddress' => true,
],

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions