문제

Actually, I know how to create a directory = mkdir.
However, I need to pass it a full absolute path in the server, and I don't know how to get the relevant path in hook_install.
I tried using base_path(), but it returned '/'.

The path I want is sites/default/files (inside "files" I create the directory).

Thanks.

도움이 되었습니까?

해결책

Did you try mkdir('sites/default/files/yourdir')? If so, where does that create the directory? If not, why not?

Relative directory names are resolved based on the working directory. The working directory in Drupal is usually the directory in which your install.php and index.php is located.

다른 팁

Please use the proper APIs.

$directory = file_default_scheme() . '://yourdir';
file_prepare_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top