Uploadex v3.0.0-rc.1 Uploadex.Files View Source
Functions to store and delete files.
Note that all functions in this module require the Uploader as an argument. You are free to call them like that:
iex> Uploadex.Files.store_files(user, MyUploader)
{:ok, %User{}}
However, by doing use Uploadex
in your uploader, you can call these functions directly through the uploader to avoid having to pass this
extra argument around:
iex> MyUploader.store_files(user)
{:ok, %User{}}
Link to this section Summary
Functions
Deletes all files for a record.
Deletes all files that changed.
Stores all files of a record, as defined by the uploader.
Link to this section Types
Link to this section Functions
Link to this function
delete_files(record, uploader)
View Sourcedelete_files(record(), Uploadex.Uploader.t()) :: {:ok, record()} | {:error, any()}
Deletes all files for a record.
Link to this function
delete_previous_files(new_record, previous_record, uploader)
View Sourcedelete_previous_files(record(), record(), Uploadex.Uploader.t()) :: {:ok, record()} | {:error, any()}
Deletes all files that changed.
Link to this function
get_file_url(record, file, field, uploader)
View Sourceget_file_url(record(), String.t(), record_field(), Uploadex.Uploader.t()) :: {status(), String.t() | nil}
Link to this function
get_files_url(record, field, uploader)
View Sourceget_files_url(record(), record_field(), Uploadex.Uploader.t()) :: {status(), [String.t()]}
Link to this function
get_files_url(record, files, field, uploader)
View Sourceget_files_url( record(), String.t() | [String.t()], record_field(), Uploadex.Uploader.t() ) :: {status(), [String.t()]}
Link to this function
get_temporary_file(record, file, path, field, uploader)
View Sourceget_temporary_file( record(), String.t(), String.t(), record_field(), Uploadex.Uploader.t() ) :: String.t() | nil | {:error, String.t()}
Link to this function
get_temporary_files(record, path, field, uploader)
View Sourceget_temporary_files(record(), String.t(), record_field(), Uploadex.Uploader.t()) :: [String.t()]
Link to this function
get_temporary_files(record, files, path, field, uploader)
View Sourceget_temporary_files( record(), String.t() | [String.t()], String.t(), record_field(), Uploadex.Uploader.t() ) :: [String.t()]
Link to this function
store_files(record, uploader)
View Sourcestore_files(record(), Uploadex.Uploader.t()) :: {: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.