mathieuprog

mathieuprog

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.

https://github.com/mathieuprog/uploader

:v:

Where Next?

Popular in Announcing Top

OvermindDL1
I created a new library (rather I pulled out a couple files from my big project), it manages an operating system PID file for the BEAM. ...
New
treble37
Just looking for a little feedback on a tiny helper library I built - Sometimes I find the need to convert maps with atom keys to maps w...
New
bryanjos
Hi, I wanted share a small library we at Revelry Labs made for rendering react components from the server side. There are instructions fo...
New
danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 30338 241
New
tmbb
I’ve been working on two packages (not on hex.pm yet) to build admin interfaces for phoenix apps: bureaucrat - which contains a bunch ...
New
kevinlang
Hey all, We have made an Ecto3 Adapter for SQLite3, ecto_sqlite3! We have successfully on-boarded the full suite of integration tests (...
New
scohen
Lexical Lexical is a next-generation language server for the Elixir programming language. Features Context aware code completion As-you...
New

Other popular topics Top

baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New

We're in Beta

About us Mission Statement