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
Hi say I want a user to be able to upload multiple avatars, but I want them to be able to set their default avatar. Since the only record I can see of avatars in the db is the array of filenames, I figured the best way to set the "default" is have it be at the zero index.
Using this guide on modifying instead of replacing uploads.
The guide shows example code of making an array copy, changing the array, then reassign it to the model's uploads. I have done this as below:
And it works! But it works by reuploading ALL the avatars all over again. This makes the action itself pretty slow, and is going to be much worse for larger images that aren't avatars. Am I missing something obvious? Is there perhaps a way to add a validation that if the upload hasn't changed position, don't reupload?
The text was updated successfully, but these errors were encountered:
Hi say I want a
user
to be able to upload multipleavatars
, but I want them to be able to set their default avatar. Since the only record I can see ofavatars
in the db is the array of filenames, I figured the best way to set the "default" is have it be at the zero index.Using this guide on modifying instead of replacing uploads.
The guide shows example code of making an array copy, changing the array, then reassign it to the model's uploads. I have done this as below:
And it works! But it works by reuploading ALL the avatars all over again. This makes the action itself pretty slow, and is going to be much worse for larger images that aren't avatars. Am I missing something obvious? Is there perhaps a way to add a validation that if the upload hasn't changed position, don't reupload?
The text was updated successfully, but these errors were encountered: