
jwandekoken
Programming Phoenix LiveView: Live Upload Match Error
Book: Programming Phoenix LiveView, page 142 (157/378), file lib/pento_web/live/product_live/form_component.ex
, in the function below:
defp handle_progress(:image, entry, socket) do
:timer.sleep(200)
if entry.done? do
# here instead of {:ok, path} I changed to path only, and it worked
path =
consume_uploaded_entry(
socket,
entry,
&upload_static_file(&1, socket)
)
{:noreply,
socket
|> put_flash(:info, "file #{entry.client_name} uploaded")
|> assign(:image_upload, path)}
else
{:noreply, socket}
end
end
Let me know if this is correct, because here It only worked when I changed.
Docs:
https://hexdocs.pm/phoenix_live_view/Phoenix.LiveView.html#consume_uploaded_entry/3-examples
Most Liked

tma_1
I ran into this too. It looks like the function Phoenix.LiveView.Upload.consume_entries has been changed to return just the results in LiveView 0.17.9.

SophieDeBenedetto
For the issues that are being described re: the flash message and filename–we’ll dig into these further as we prepare for a non-trivial code upgrade for the latest versions of LiveView once 0.18 is released in the coming weeks and months. Stay tuned for updates in the meantime I recommend moving on to the next chapters.
Thanks all for your valuable input and feedback!

SophieDeBenedetto
Hello! We are hard at work on a major revision right now and plan to release a new version of the book before the end of February.
Popular Prag Prog topics










Other popular topics










Latest in PragProg
Latest (all)
Categories:
Popular Portals
- /elixir
- /opensuse
- /rust
- /kotlin
- /ruby
- /erlang
- /python
- /clojure
- /react
- /quarkus
- /go
- /react-native
- /vapor
- /v
- /wasm
- /django
- /security
- /nodejs
- /centos
- /rails
- /haskell
- /fable
- /gleam
- /swift
- /deno
- /js
- /tailwind
- /assemblyscript
- /laravel
- /symfony
- /phoenix
- /crystal
- /typescript
- /debian
- /adonisjs
- /julia
- /arch-linux
- /svelte
- /spring
- /preact
- /c-plus-plus
- /flutter
- /actix
- /java
- /angular
- /ocaml
- /kubuntu
- /zig
- /scala
- /zotonic
- /vim
- /rocky
- /lisp
- /keyboards
- /html
- /emacs
- /nim
- /vuejs
- /nerves
- /elm