When I read my user, I see
%MyApp.Api.user{
profile_photo: %{
file_name: "2018-12-28 15:46:53.330536Z.png",
updated_at: ~N[2018-12-28 15:46:53]
},
}
but when uploading I use this changeset:
def update_photo_changeset(user, attrs) do
user
|> cast(attrs[:user], [:profile_photo])
|> cast_attachments(attrs, [:profile_photo])
|> validate_required([:email, profile_photo])
end
Logging the attrs out I can see the binary and filename. When I read I only see filename.
How do I directly read binary data?
Arc.File
is a struct having three fields.Algebra.Inspect
, that is used to represent the file in the console, prudently ignores the binary garbage.%MyApp.Api.User{}.profile_photo
should be not a map but%Arc.File{}
struct and I doubt I can tell why it’s a bare map.In any case, the struct has a directly accessible field
binary
: