logoalt Hacker News

adamzwassermanlast Thursday at 7:02 PM1 replyview on HN

Honestly? I never think about it. I've never had to. What did you run into? Curious what the pain point was.


Replies

yellow_leadlast Thursday at 7:12 PM

I had a site where the user can upload a file < 5MB. There may be a way to check this on the frontend, but for security reasons, it has to be checked on the backend too.

If it exceeds it, I returned 400. I had to add an event listener to check for the code (htmx:afterRequest) and show an alert(), but this gets difficult to manage if there's multiple requests to different endpoints on the page. Looking at it now, maybe I should have configured HTMX to swap for 4xx.

show 2 replies