View Source Uploadex.FileStorage (Uploadex v3.1.0)

Storage for Local Files.

Opts

  • directory: String (required for all functions) - Relative to base_path
  • base_path: String (required for all functions)
  • base_url: String (required for Uploadex.Storage.get_url/2)

To build the URL, base_path will be replaced by base_url.

Example

To use this storage for your User record, define these functions in your Uploadex.Uploader implementation:

def default_opts(Uploadex.FileStorage), do: [base_path: :code.priv_dir(:my_app), base_url: Endpoint.url()]

def storage(%User{} = user, :photo), do: {Uploadex.FileStorage, directory: "/uploads/users"}