Uploadex v2.0.2 Uploadex.Files View Source

Functions to store and delete files.

Link to this section Summary

Link to this section Types

Link to this type

record_field()

View Source
record_field() :: atom()
Link to this type

status()

View Source
status() :: :ok | :error

Link to this section Functions

Link to this function

delete_files(record)

View Source
delete_files(record()) :: {:ok, record()} | {:error, any()}

Deletes all files for a record.

Link to this function

delete_previous_files(new_record, previous_record)

View Source
delete_previous_files(record(), record()) :: {:ok, record()} | {:error, any()}

Deletes all files that changed.

Link to this function

get_file_url(record, file, field)

View Source
get_file_url(record(), String.t(), record_field()) ::
  {status(), String.t() | nil}
Link to this function

get_files_url(record, field)

View Source
get_files_url(record(), record_field()) :: {status(), [String.t()]}
Link to this function

get_files_url(record, files, field)

View Source
get_files_url(record(), String.t() | [String.t()], record_field()) ::
  {status(), [String.t()]}
Link to this function

get_temporary_file(record, file, path, field)

View Source
get_temporary_file(record(), String.t(), String.t(), record_field()) ::
  String.t() | nil | {:error, String.t()}
Link to this function

get_temporary_files(record, path, field)

View Source
get_temporary_files(record(), String.t(), record_field()) :: [String.t()]
Link to this function

get_temporary_files(record, files, path, field)

View Source
get_temporary_files(
  record(),
  String.t() | [String.t()],
  String.t(),
  record_field()
) :: [String.t()]
Link to this function

store_files(record)

View Source
store_files(record()) :: {:ok, record()} | {:error, any()}

Stores all files of a record, as defined by the uploader.

Files that are not maps are ignored, which allows for assigning an existing file to a record without recreating it, by simply passing it's filename.