Playing with Files in Drupal

Drupal has file URI of the format similar to

public://folder/filename.ext

Where there are several datasets

  • public
  • private
  • temporary

There are several functions that are useful to know;

The local path in the local File System

$path = drupal_realpath($uri);

The external URL referenced from the web server

$url = file_create_url($uri);

There are more in the reference.

Leave a Reply

Your email address will not be published. Required fields are marked *