PhoenixKit.Modules.Storage.Providers.Local (phoenix_kit v2.52.2)

Copy Markdown View Source

Local filesystem storage provider.

Stores files on the local filesystem using the configured endpoint path. Suitable for development, testing, and single-server deployments.

Summary

Functions

Where a storage path points on disk: absolute as it stands, a relative one taken from the directory the application started in (see root/1).

The bucket's directory as an absolute path. A relative endpoint (the default is priv/media) is relative to the directory the application started in, not to the current one: the working directory is VM-wide, and in development Phoenix's code reloader switches it into each path dependency while it recompiles — a relative read or write during that window lands in the dependency's directory.

Functions

resolve_path(path)

@spec resolve_path(String.t()) :: String.t()

Where a storage path points on disk: absolute as it stands, a relative one taken from the directory the application started in (see root/1).

The one place a path is made absolute, so the form's preview, its existence check and the files themselves can never name different directories.

root(bucket)

@spec root(map()) :: String.t()

The bucket's directory as an absolute path. A relative endpoint (the default is priv/media) is relative to the directory the application started in, not to the current one: the working directory is VM-wide, and in development Phoenix's code reloader switches it into each path dependency while it recompiles — a relative read or write during that window lands in the dependency's directory.