Neophen
External uploads custom metadata
Is there a way to add custom meta data back to entry after the upload?
import { UploadClient } from '@uploadcare/upload-client'
const client = new UploadClient({ publicKey: "publicKey" })
const Uploadcare = (entries, onViewError) => {
const uploadEntry = makeEntryUploader(onViewError)
entries.forEach(uploadEntry)
}
const makeEntryUploader = (onViewError) => async (entry) => {
const onProgress = ({ isComputable, value }) => {
if (isComputable) {
let percent = Math.round(value * 100)
if (percent < 100) { entry.progress(percent) }
}
}
const abortController = new AbortController()
onViewError(() => abortController.abort())
const result = await client.uploadFile(entry.file, {
onProgress,
signal: abortController.signal,
})
// How to add the data to the entry?
entry.meta = {
...entry.meta,
// This doesn't work:
uploadcare: result
}
entry.progress(100)
}
const uploaders = {
Uploadcare,
}
export default uploaders
I have this in the live view:
defp presign_upload(entry, socket) do
meta = %{uploader: "Uploadcare"}
{:ok, meta, socket}
end
But I only get the url and stuff in the response from the await client.uploadFile(entry.file, {
Has anyone ran into this? Do I need move the uploading to the server side to get the required data?
Marked As Solved
Neophen
For anyone else interested this is the current solution i arrived at.
It’s a hack with the least amount of indirection that i could come up with.
Popular in Questions
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service.
Currently when I de...
New
For example for a current url like
http://localhost:4000/cosmetic/products?_utf8=✓&query=perfume&page=2,
I would like to get:
...
New
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
Hey all,
I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
Hello, I have map which I want to convert it to string like this:
the map:
%{last_name: "tavakkoli", name: "shahryar"}
the string I ne...
New
I have followed this StackOverflow post to install the specific version of Erlang.
And When I am running mix ecto.setup then getting fol...
New
I will often find my self writing things similar to:
case some_value do
nil -> something()
"" -> something()
_ -> somethi...
New
i’m a new one to elixir
which editor can i use
vs code? or atom?
Thanks! :smiley:
New
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
Other popular topics
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
Hey all,
I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
Hello everybody,
usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
Hey,
Just curious what are the main benefits of Elixir compared to Clojure?
When is Elixir more useful than Clojure and vice versa?
Th...
New
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
I am trying to run a deploy with docker and I successfully runned with this command:
docker build -t romenigld/blog-prod .
but when I t...
New
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
Update:
How to use the Blogs & Podcasts section
You can post links to your blog posts or podcasts either in one of the Official Blog...
New








