I set up the file attach source and copied a directory hierarchy into the attach directory. The list of available files to attach then showed me the base filenames of all files it found in my hierarchy. Attaching one failed though because the assumption was made that the file would be in the top level. Additionally, not being able to see the full filepaths made it hard for me to know which file I wanted to choose.

This patch allows the attachment of files in subdirectories of the attach directory and shows in the select list the full path to the files.

Comments

jody lynn’s picture

StatusFileSize
new1.17 KB

I guess I can delete one more line as well. New patch.

huteb’s picture

Hi,

I just tested the patch and it seems to work great. I have one question : would it be possible to not show the full path but only the path relative to the main folder ? Users would usually only want to select subdir/file and not /path/to/attach/dir/subdir/file.

Cheers,
Hugh

vegantriathlete’s picture

Right now, I have 6.x-1.2 installed without the patch. It does seem to find all the files that are in the directories that are at or below the path I have named in the file_attach directory (which is specified as sites/all/files/images). However, when I choose a file to attach, I get the following error message:

warning: rename(sites/all/files/images/SCBuild004671.jpg,sites/all/files/images/SCBuild004671.jpg) [function.rename]: No such file or directory in /data/web/htdocs/www-dev/drupal-6.20/sites/all/modules

I think this is due to the fact that the file actually resides at sites/all/files/images/sc_build/SCBuild004671.jpg

Thus, fiefield_sources finds it there, but then tries to do a rename from sites/all/files/images/SCBuild004671.jpg and finds that there is no such file.

So, I think your patch is designed to address this. I will check it out.

vegantriathlete’s picture

I manually applied the patch from comment #1 and it works like a charm!

I tested sites/all/files/images/3D_visualization.jpg as well as sites/all/files/images/sc_build/SCBuild004671.jpg and sites/all/files/images/rc_group/rack01.jpg. IOW, I tested file directly under the root as well as in subdirectories below it.

Can we get one more person to check this out so that we can mark this RTBC?

quicksketch’s picture

Component: Code » Source: Attach (FTP)
Status: Needs review » Fixed

Thanks Jody et. all. I committed a nearly identical patch over in #957818: Getting file not found errors when using subdirectories.

Status: Fixed » Closed (fixed)

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