I have a previously developed module for D7 that supports some of the advanced image display capabilities of the Zoomify JS  codes. These exist as a sandbox project at this time.  I'm currently thinking of rewriting them for better usability and security. One of the problems I have is a requirement to have a set of unique directories for each content entry. That is Pic1, pic2 . .. Picn each would have a mustard set of sub directorates.  I can easily create and manage these directory structuresbut I do not know howI could go about uploading the files into the appropriate locations.  For instance pic1/assets/media/music.mp3.


In the Drupal 7 system I tried to use  he file_field_paths module.  It was not satisfactory.  The Zoomify code requires a Lot of filand I could not figure out ow to programmatically activate the paths. Thus the user would have to spend 10-15 minutes individually activating each field.  You only have to open the fields settings form and then save it. No changes are really needed  You only have to do it once but is a pain  Also FFP has a bug which causes intermittent crashes. The maintainers seem unwilling to address the issue though I sent them detailed instructions on how to duplicate and a fix for the problem. (Poorly written if statement)

So I would like some suggestion how I could control the location a file is placed in so that it is unique to ifs individual content item. Could someone please offer some advice or point me in the directio  of the proper API's or documentation?


Sounds like the File (Field) Paths module is what you need. With it, you can do something like this:

Image field path token

This will make it so that when you create a new Post node (e.g. with a node ID of '54') and upload an image to it, that image will be saved in: files/images/posts/54/

bugfolder's picture

Bill, you mentioned "a bug in FFP". Guessing that "FFP" is filefield_paths? As BWPanda noted, there is a Backdrop version. If you try it out and it exhibits the same bug as the D7 version, please file an issue in its issue queue. It's not guaranteed, but often the Backdrop module maintainers are more responsive than the corresponding D7 module maintainers.

Oops, missed that. Thanks!

Thanks for your quick response. .  I have used File Field Paths in my module and it does work, but I have come to detest it.

The problem is two fold.

One is that yo9u can not activate the paths from the module.  I can pass all the relative date but you have to activate each field individually through the GUI.  This means just opening the field settings form and saving it. All the data is there.  This is really a pain because I have a LOT of files to be placed. 

Secondly the thing has a bug where if it encounters a BLANK unfilled text field it will give a warning or crash the system.  It's a bad crash. It took out apache on my local system and also wreaked such havoc on my production sites I had to have the Hosting company restore them.  The fix is trivial . A one character change to the if statement. (!) I think it's a typo in the code.

 I am trying to devise a method to allow me to control the file handling directly. This module I'm working on has many files. It also has potential for very large files. 3-4 gigabytes.  Ive tried to use the Drupal system but all the file upload methods seem to fail as you approach 3.96 gigabytes. I know that is extreme but the system will work up to around 900 megabytes with little problem.  In any case, I need to revamp the file handling in my system. if I have to revisit it I'd like to not make it dependent on another module.

I will take a look at the backdrop version of ffp and see if the if statement is still unchanged.  If it appears bad I will port my test module over and see if I can replicate the error. If so I will certainly raise the issue.

I can generate a path for uploading a file I just need to know if or how to pass it to the backdrop file  upload  form functions.


Thanks once again