i'm trying to make local file upload, but when i do POST request, i got invalid CSRF (Cross Site Request Forgery) token, make sure all requests include a valid '_csrf_token' param or 'x-csrf-token' header error
i already try to call this function
def csrf_token(conn) do
Plug.Conn.get_session(conn, :csrf_token)
end
my .html.eex :
<form action="/accounts/new/csv-validator" method="post"
enctype="multipart/form-data">
<input type="hidden" name="_csrf_token" value="<%= @get_csrf_token() %>">
<input class="form-control input-bordered" id="user_photo" name="user[photo]" type="file">
</form>
expected result : success to do POST with valid csrf token
Phoenix Version : v1.3.4
name="csrf-token" id="csrf-token" value="<%= Plug.CSRFProtection.get_csrf_token() %>"- script