azalea v0.0.1 Azalea.File

The file struct need for this module.

  • filename, the file’s name of the file
  • type, the file’s content type, eg: :jpg, :png, :gif
  • path, the file’s path in disk or the key in the cloud
  • valid, check if the file is valid
  • uploader, the uploader of the file, normally is local or other uploader handler
  • module, the module you defined to perform all the operation
  • url, the url path of the file, you can get the file through this

Summary

Functions

Cast from other struct, include Map, Plug.Upload, Ecto.Changeset

Delete the file data from local disk

Check if the File struct is empty

Save the file to a new position

Check if the file is valid

Functions

cast_file(params, field \\ nil)

Cast from other struct, include Map, Plug.Upload, Ecto.Changeset

  • params struct of the file you want to convert
  • field optional key for you to define which fied of the struct is Azalea.File
delete(struct)

Delete the file data from local disk

invalid_empty_struct()
is_empty?(struct)

Check if the File struct is empty

save(origin, new)

Save the file to a new position

valid?(file)

Check if the file is valid