Hi guys,

I've got a problem with the file_directory_path() function.

It always returns the path of a directory named "resources" which I’ve created in 'sites\default\files'. However, other directories have been created and should be used.

This causes a serious problem when I want to use the file_create_url() function which also uses the file_directory_path() function (=> malformed URL : sites/default/files/resources/sites/default/files/entities/file.png)

What can be done about it ?

Thanks for helping !

C:\wamp\www\mySite\sites\default\files>dir
 Volume in drive C has no label.
 Volume Serial Number is D041-0B2A

 Directory of C:\wamp\www\mySite\sites\default\files

05/18/2010  07:29 PM    <DIR>          .
05/18/2010  07:29 PM    <DIR>          ..
03/30/2010  05:54 PM                93 .htaccess
03/21/2010  07:14 PM    <DIR>          .svn
06/08/2010  12:43 PM    <DIR>          entities
02/13/2010  12:08 PM    <DIR>          images
06/08/2010  02:18 PM    <DIR>          resources
               1 File(s)             93 bytes
               6 Dir(s)     366,759,936 bytes free

Comments

jaypan’s picture

Maybe it's set as such at administer -> settings -> file directory (I think that's the path).

Contact me to contract me for D7 -> D10/11 migrations.

60sman’s picture

ho great !

I forgot about it.

Thanks Jay !

cog.rusty’s picture

You can't do that. If the "files" directory specified in admin/settings/file-system is

sites/default/files/resources

You can't have file paths like

sites/default/files/entities

Everything must be under the "files" directory that you have specified.

What happened in your case is that http://api.drupal.org/api/function/file_create_url/6 tried to strip your specified "files" paths and keep the rest, it didn't find it, it didn't strip it.

60sman’s picture

ok, understood. Thanks cog.rusty !