The context is I upload files and I want to access to the File object (the one you normally get in the browser with event.target.files. I want to do some work on it with the Image or Vix library, something like Vix.Vips.Image.new_from_buffer (no idea if this works at this stage).
The file input is captured in the live_file_input under the attribute uploads. I want to access it in the handle_event("validate"...) stage. It must be accessible somehow since it is pre-rendered, probably via a createObjectURL. If I inspect the socket.assigns at this stage, I donāt find any binary, mostly metadata. Is this accessible at this stage? Or if not, where is the binary of the file accessible?
I tried a few of the keys below:
get_in(socket.assigns, [:uploads, :image_list]) |> Map.keys()
[:external, :name, :accept, :chunk_size, :writer, :__struct__, :errors, :ref,
:max_entries, :max_file_size, :cid, :entries, :auto_upload?, :progress_event,
:allowed?, :chunk_timeout, :entry_refs_to_metas, :acceptable_types,
:acceptable_exts, :client_key, :entry_refs_to_pids]
The entries doesnāt seem to include a binary.
%Phoenix.LiveView.UploadEntry{
progress: 0,
preflighted?: false,
upload_config: :image_list,
upload_ref: "phx-F4EePzKBzRijVC6C",
ref: "0",
uuid: "3b4fa1c5-ba8a-41d5-adbb-ed4b274b12ad",
valid?: true,
done?: false,
cancelled?: false,
client_name: "Screenshot 2023-08-04 at 21.04.26.png",
client_relative_path: "",
client_size: 16701,
client_type: "image/png",
client_last_modified: 1691175871713
}
]






















