I have a content type with multiple filefield_sources fields, and each has its own destination folde specified. When the name is, say, "grants/rfp", filefield_sources retrieves the file from out on the web just fine, but the destination path stored is site root + tmp folder path. I am not sure whether the file gets moved at all- it appears it does not. If i rename "grants/rfp" to "grants-rfp" then the process works, but the destination path is ignored and the file is placed under sites/default/files.

Comments

quicksketch’s picture

Category: bug » support
Status: Active » Fixed

What server software are you running (OS, web server) and is your files directory writable? It sounds like FileField Sources can't create the directories in file directory.

EDIT: Ah, looks like this is duplicate of #881444: Troubleshooting why remote fetch works locally but not remotely on staging. Marking fixed.

texas-bronius’s picture

Title: Filefield_Sources doesn't appear to honor cck-field config path, and yet it breaks on path with slash in it » Filefield_Sources doesn't create not-yet-existent cck-field config path and therefore cannot move file to final destination
Category: support » bug
Status: Fixed » Active

To reproduce and confirm that it's only filefield_sources and not filefield or file system permissions:

  1. set up a filefield and path: verify that its custom path does not yet exist. Ex. grants/rfp
  2. grab a link off the web and have fieldfield_sources try to place it: notice that its final local path destination is something botched like siteroot+/+drupal_tmp
  3. now, Browse and upload a local file to this same filefield. Filefield will create the custom destination path and place the file
  4. finally, grab a link off the web again: notice that this time the file is place appropriately as expected

Temporary workaround: make sure your filefield custom paths exist before using filefield_sources to grab files off the web.

capsicumpie’s picture

I think I have a similar problem. Under 'path settings' I've set the file path to contain subfolders based on tokens. However, no subfolders are ever created, despite the permissions on the designated base folder being fully writable.

In further testing I just tried static subfolder names and noted the following behaviour:

  • A single subfolder (e.g. some_folder/subfolder1) results in the file being placed in 'some_folder'. No subfolder was created.
  • A second subfolder (e.g. some_folder/subfolder1/subfolder2) places the files in the 'tmp' folder. No subfolders were created.
  • Creating a normal filefield field without filefield_sources enabled on it does allow subfolders to be created
soup1977’s picture

I'm having this issue as well. Just a regular old upload works fine and creates the correct directory structure. But when I use the Remote URL option. It doesn't work and puts it somewhere?

texas-bronius’s picture

So, from the outside looking in, it looks like it would be helpful if fieldfield_sources would create the destination folder if the specified path does not yet exist, just like fieldfield already does.

I'll be honest.. I spot-perused both fieldfield and fieldfield_sources code and didn't come up with the difference I think I am looking for :)

brianfisher’s picture

StatusFileSize
new1.93 KB

This is a problem for both remote and attach sources, field_file_save_file() doesn't recursively create directories.

http://drupal.org/node/440574

so I've added a call to field_file_check_directory() as suggested in the attached patch (for 6.x-1.2)

quicksketch’s picture

Title: Filefield_Sources doesn't create not-yet-existent cck-field config path and therefore cannot move file to final destination » Check directory permissions before saving remote or attached files
Component: Code » General
Priority: Normal » Minor
Status: Active » Fixed
StatusFileSize
new4.4 KB
new2.59 KB

I've committed these patches to add this functionality. Thanks @tbfisher.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.