开发者

Replace directory path Drupal 6.20

I try to guard a file, which I sa开发者_如何学编程ve from a form, in a path I specify. I use file_directory_path that returns the path to default, what do i do to change the path or to modify it to personalize it?

Code that this done but it does not function

 $filepath='/sites/ficheros_profesores';
//   str_replace(file_directory_path(),'',$filepath); 
     $file = file_save_upload('test',null,file_directory_path());
     file_set_status($file, FILE_STATUS_PERMANENT);

Thanks


If I properly understood, you are trying to save the uploaded file in a folder which is inside the default 'files' directory, isn't it?

Instead str_replace, you could concatenate the strings with '.'. Simply:

$file = file_save_upload('test',null,file_directory_path().'/sites/ficheros_profesores');

You should then ensure that the '/sites/ficheros_profesores/' exists and that the 'www-data' user (asuming linux) has the proper permissions.

Hope it helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜