Flysystem enables you to use remote storage like an FTP server or Dropbox as if it were a normal local folder. It is compatible with Filefield_paths, though some adapters may need tweaks.

Specifically (status as of 20 apr 2016):

- Local adapter works out of the box

- Dropbox adapter works out of the box

- FTP adapter needs you to replace the string "return ['type' => 'dir', 'path' => $path];"
to "return ['type' => 'dir', 'path' => $path, 'visibility' => 'public'];"
in the file /public_html/vendor/league/flysystem/src/Adapter/Ftp.php:337 (method getMetadata($path))

CommentFileSizeAuthor
1454942944_filefield_paths.patch632 bytesjonathanshaw
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jonathanjfshaw created an issue. See original summary.

jonathanshaw’s picture

So I've tested myself. Here's what I found using filefield_paths with flysystem_dropbox:

1) uploading a file work fine and renaming by token works fine
2) when "Active updating" the file is moved, but the file's database entry is not updated with the new name. Given that filefield_paths sems to use core's file_move() function for both, this looks like a Flysystem issue not a Filefield_paths issue.
3) The attached patch does nothing useful as far as I can see.

jonathanshaw’s picture

Category: Feature request » Support request
Issue summary: View changes

OK, my developers now report that the patch is no longer needed. Here's the details I got from them, which has various bits that may be useful to anyone trying this:

1) Install the new D8 site, composer and drush8 as usual

2) Download the modules: composer_manager, filefield_paths, flysystem, flysystem_dropbox
drush8 dl composer_manager filefield_paths flysystem flysystem_dropbox
composer drupal-update
composer require "guzzle/guzzle:3.x" # it is needed for flysystem_dropbox whitch uses Url::factory() (for now Drupal uses guzzlehttp/guzzle:6.x)
drush8 en filefield_paths flysystem flysystem_dropbox

3) Add $settings['trusted_host_patterns'] for your domain/localhost into the settings.php file

4) Configure your dropbox token and other standard Flysystem settings in settings.php

6) Configure Flysystem and Dropbox as normal for a file field through the UI. Change your field to save the files with node title
(FILE (FIELD) PATH SETTINGS -> File name -> [node:title].[file:ffp-extension-original] and renaming)
and save on dropbox (here /admin/structure/types/manage/article/fields/node.article.field_image
and here http://drupal8.loc/admin/structure/types/manage/article/fields/node.arti...)

FTP adapter
If you want to use FTP then you need to replace the string "return ['type' => 'dir', 'path' => $path];"
to "return ['type' => 'dir', 'path' => $path, 'visibility' => 'public'];"
in the file /public_html/vendor/league/flysystem/src/Adapter/Ftp.php:337 (method getMetadata($path))

Dropbox
I'm still seeing the problem in #2#2 for Dropbox - the file is moved but the file entity is not updated. I believe this needs a 1 line fix to one of the Flysystem components.

jonathanshaw’s picture

Issue summary: View changes

OK, I now have dropbox working completely. You need to patch Drupal's module "Flysystem dropbox" to require the "dev-master" version of the upstream library "Flysystem dropbox", until such time as that library releases a 1.02 version. You do not need to change/add the Guzzle version, it works fine as is.

jonathanshaw’s picture

Issue summary: View changes

Flysystem dropbox has released version 1.02 so Filefield paths now works with Flysystem dropbox out of the box.

voleger’s picture

Status: Active » Closed (works as designed)