Hello, I am converting a page to liveview; in my controller I have this
conn
|> put_resp_header("content-disposition", "attachment; filename=#{file_name}")
|> send_resp(200, content)
I attempted replacing conn
with socket
but that did not work. Now I understand websockets do not have headers. Does anyone have any ideas for the best approach to this problem?
The solution I’ve come with so far is to hit a Phoenix /export
route (non-liveview). The only issue is that when I embed the eex
template into my liveview, conn
is not available for eex template. To solve that I just passed in the socket to replace conn.
My issue now is this:
invalid CSRF (Cross Site Request Forgery) token, please make sure that:
I have tried passing down the csrf_token
of the liveview parent down to the child every which way possible. Nothing works. Is there something I don’t know?