HELLO.
I am trying to do file uploads in liveview.While i am uploading entries, i have noticed that the name defaults to liveview upload_unique id . check out this save event
def handle_event("save", _params, socket) do
uploaded_files =
consume_uploaded_entries(socket, :avatar, fn %{path: path}, _entry ->
dest = Path.join(Application.app_dir(:jungle, "priv/static/uploads"), Path.basename(path))
# You will need to create `priv/static/uploads` for `File.cp!/2` to work.
name = System.shell("exiftool -FileName #{path}")
dbg(name)
# System.shell("ffmpeg -i #{path} -f ffmetadata in.txt")
# System.shell("ffmpeg -i #{path} lovejustindavedd.m4a")
File.cp!(path, dest)
{:ok, ~p"/uploads/#{Path.basename(dest)}"}
end)
{:noreply, update(socket, :uploaded_files, &(&1 ++ uploaded_files))}
end
the path variable which as i have logged in iex contains the actual upload
How can i retrieve the file name from the upload ??