I have a form that uploads a file to my Drupal installation. I want to store the path to that file in a table. How do I get the path to the recently uploaded file? I tried
$f = file_load($form_state['values']['field_file']);
$f->uri;
But that's not working. Any clues?
$f = file_load($form_state['values']['field_file']);
$url = file_create_url($f->uri);
The URI is the public:// private:// etc which Drupal uses internally. To convert it use file_create_url(); Ideally you should still store the URI and then use the file_create_url()
when rendering.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With