Community & Support

Problem with the file_directory_path() function

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

Maybe it's set as such at

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

Full-time freelancer, always looking for work.
jaypan.com (my portfolio)

ho great ! I forgot about

ho great !

I forgot about it.

Thanks Jay !

.

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.

ok, understood. Thanks

ok, understood. Thanks cog.rusty !

nobody click here