I have a site under "sites/default" and files folder in "sites/default/files".
When I upload an image, an extra "sites/default" directory is created under "sites/default/files" which eventually looks like this - "sites/default/files/sites/default".
The directory is empty and everything seems to work fine.
I looked in the code and debugged function filefield_paths_file_move
a little bit. When I do echo $path = file_create_path(implode($dirs, '/'));
I get the following results:
sites/default/files/sites
sites/default/files/sites/default
sites/default/files
It seems that _filefield_paths_check_directory()
function creates these directories along the way.
Comments
Comment #1
thtas CreditAttribution: thtas commentedsubscribing. I have a similar issue.
Comment #2
Starminder CreditAttribution: Starminder commentedsubscribe
Comment #3
Deciphered CreditAttribution: Deciphered commentedStrange, there is a specific function around that section that is there to strip out that path in the case that a user has entered it in the filepath setting of the file incorrectly.
Can you tell me what your fields FileField Paths settings are?
And also what have you got set in 'File system path' in admin/settings/file-system?
Cheers,
Deciphered.
Comment #4
maijs CreditAttribution: maijs commentedDeciphered, I have pretty standard setup. FileField Path settings are:
1. File name in field settings: [nid]-[filefield-onlyname-original].[filefield-extension-original] ([nid] is replaced with Node ID by Token module);
2. File system path: sites/default/files, temporary directory: /tmp, public method.
Changing the settings, I discovered than extra sites/default directory is being created in sites/default/files only when Token pattern is placed in field "File name" field. If I leave default [filefield-onlyname-original].[filefield-extension-original] filename then directory is not created.
Comment #5
Deciphered CreditAttribution: Deciphered commentedWhat have you got in File Path?
Comment #6
maijs CreditAttribution: maijs commentedFile Path is empty. Here is the complete spec:
1. File Path: empty
2. File path cleanup settings: nothing checked
3. File Name: [nid]-[filefield-onlyname-original].[filefield-extension-original]
4. File name cleanup settings: "Convert to lower case" and "Transliterate" checked
5. Retroactive update: not checked
6. Active updating: not checked
In Site configuration > File system > File system path I have standard "sites/default/files"
Comment #7
Deciphered CreditAttribution: Deciphered commentedThanks maijs,
I suspect the issue is related to the empty filepath, can you confirm that that is the case?
As strange as it is, it's very rare for anyone to use this module without a filepath, so for this to be the cause of the reason isn't as surprising as it should be.
Will definitely be fixed in the upcoming 2.x release.
Cheers,
Deciphered.
Comment #8
maijs CreditAttribution: maijs commentedDeciphered,
Correct, if file path is set then sites/default folder is not mistakenly created.
I use FileField Paths to attach node id to the filename, I do not manage files in directories.
Comment #9
Deciphered CreditAttribution: Deciphered commentedMaijs,
That is a perfectly acceptable use case, and should definitely work.
As a short-term work-around, try putting a single forward-slash ('/') in the file path field.
It's untested, but theoretically it should do the job.
Cheers,
Deciphered.
Comment #10
Deciphered CreditAttribution: Deciphered commentedNo longer supporting Drupal 6 issues for this module.