How to fix this warning: file_get_contents (): Could not find the shell "public"?

I need to read some meta information from the downloaded file. But I do not know how to do this.

Here is my code:

// Path form field_file
$file = 'public://directory/filename.txt';
file_get_contents($file);

This code triggers this warning:

Warning: file_get_contents (): Could not find the public shell - did you forget to enable it when setting up PHP?

Any idea on what I'm doing wrong, please?

+5
source share
3 answers

There are three internal stream wrappers, private, public and temporary, defined in this file.

file_get_mimetype(), file_get_contents - PHP drupal api.

file_get_contents(drupal_realpath($file));

.

file_save_upload()

+4

, hook_boot() . , , , .

+2

, , - :

echo base_path().variable_get('file_public_path',conf_path().'/files');

- , .

0

All Articles