Uploader - file upload with fine control over how a Plug.Upload is casted and stored

Hello :wave:

This is my second published Elixir library :tada:

There are already many file upload libraries, but this one was created to allow the user to personalize:

  • how a Plug.Upload struct is casted into the value that must be stored in db;
  • the filename(s) that must be generated based on a given schema struct;
  • the strategy to apply when a file path already exists;
  • etc.

This allows to address some more specific use cases.

Example: imagine a CMS allowing to upload the cover image of a blog post. The blog post is written into multiple languages. For SEO purposes, we want the filename of the cover image also to be translated into these languages (this is particularly important for an online business which relies heavily on SEO techniques to obtain incoming web traffic). For this case, the library will allow to:

  • cast the Plug.Upload struct into a map of filenames per language;
  • return multiple filenames for a single upload (multiple files will be stored);
  • print the file URL based on the reader’s language.

That use case is really very specific, but it was the motivation behind the writing of that library.