You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't really want users to be able to decide the filename, so I would rename the folder and file after upload to something like this.
def filename(version, _) do
"picture.jpg"
end
def storage_dir(_, {_, %{ uuid: uuid } }) do
"uploads/section/pictures/#{uuid}"/[avatar||status_image]
end
*Problem however is that i have no way of knowing if i'm dealing with :avatar or :status_image when processing a file, the only context I seem to get is the complete changeset. So the second upload will simply just override the first one on the disk if a user uploads both an avatar and a status-image. *
Is there a way to make the Uploader aware of which "field" it's dealing with?
(Sure I could create a new model that keeps tabs on images, but it seems a bit of a weird hoop).
The text was updated successfully, but these errors were encountered:
Hey there, I've been using Arc and Arc Ecto with lot's of luck so far. I'm however dealing with a small minor issue.
Say i have this model:
User:
I want a thumb and a 500x500px picture for both the avatar and the status-image, so I'm not bothering writing 2 uploaders with identical code.
Then I cast attachments like this in the changeset:
I don't really want users to be able to decide the filename, so I would rename the folder and file after upload to something like this.
*Problem however is that i have no way of knowing if i'm dealing with :avatar or :status_image when processing a file, the only context I seem to get is the complete changeset. So the second upload will simply just override the first one on the disk if a user uploads both an avatar and a status-image. *
Is there a way to make the Uploader aware of which "field" it's dealing with?
(Sure I could create a new model that keeps tabs on images, but it seems a bit of a weird hoop).
The text was updated successfully, but these errors were encountered: