Phoenix channels how to push a file through a socket

I have a form that has text input and file input. Anyway, to pass this through a socket to submit?

If I add this as

params.image = $("#new_post_image")[0].files[0] 

My parameters look like this in the channel

 %{image: %{}, title: "image title"} 
+6
source share
1 answer

I would say that this approach is basically incorrect. Instead, the file upload should be done by loading the form in multiple elements, which then should return the file identifier, and then you can attach that identifier to the form so that it retains the link.

0
source

Source: https://habr.com/ru/post/1257562/


All Articles