Uploadex v2.0.0 Uploadex View Source

Context Helper functions for handling files.

Link to this section Summary

Functions

Inserts the changeset and store the record files in a database transaction, so if the files fail to be stored the record will not be created.

Deletes the record and all of its files. This is not in a database transaction, since the delete operation never returns errors.

Updates the record and its files in a database transaction, so if the files fail to be stored the record will not be created.

Similar to update_with_file/3, but does not delete previous files.

Link to this section Functions

Link to this function

create_with_file(changeset, opts \\ [])

View Source

Inserts the changeset and store the record files in a database transaction, so if the files fail to be stored the record will not be created.

Link to this function

delete_with_file(record, opts \\ [])

View Source

Deletes the record and all of its files. This is not in a database transaction, since the delete operation never returns errors.

Link to this function

update_with_file(changeset, previous_record, opts \\ [])

View Source

Updates the record and its files in a database transaction, so if the files fail to be stored the record will not be created.

This function also deletes files that are no longer referenced.

Link to this function

update_with_file_keep_previous(changeset, opts \\ [])

View Source

Similar to update_with_file/3, but does not delete previous files.