New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update multiple files without replace #1844
Comments
Hi @Tecktoart, you haven't provided enough information in order for us to be ale to work out what you're trying to do. I'm closing this issue until you can update with sufficient details. |
@thomasfedb, I have updated, please verify |
What do you mean by "replace"? Please demonstrate. |
I have created opportunity with 2 files My files When I have added one file on update form, my files have replaced in database on last file from update form. My last file from update form |
+1 on this one, it appears that on multiple files upload, previously stored files are being replaced by newer one(s). Trying to find a way to hack around this but without any success so far. |
+1 I'm having the same issue here. I've tried to use this how to but the files still being replaced. |
Seems to be fixed by the following 🐒patch: CarrierWave::Mounter.class_eval do
def cache(new_files)
return if not new_files or new_files == ""
@uploaders = new_files.map do |new_file|
if new_file.is_a?(uploader_class)
uploader = new_file
uploader
else
uploader = blank_uploader
uploader.cache!(new_file)
uploader
end
end
@integrity_error = nil
@processing_error = nil
rescue CarrierWave::IntegrityError => e
@integrity_error = e
raise e unless option(:ignore_integrity_errors)
rescue CarrierWave::ProcessingError => e
@processing_error = e
raise e unless option(:ignore_processing_errors)
end
end
CarrierWave::Uploader::Base.class_eval do
def identifier
File.basename(path) if path
end
end @thomasfedb if it looks ok I can send a PR with the patch |
I solved this issue by adding this to the model with the images attached. I am a novice coder so I can't promise it is the fastest, but it does work. I have the images stored as JSON.
|
+1 I'm having the same problem here. i was sending param with two params the first one is remote_url and the second one is params for file but always get replaced with the file |
Closed by #2401. |
I see you added a way to do this inside the view, but is there any way to achieve this in the model or controller for use cases with rails? We are not using erbs on our application so that solution in the README will not work. |
Sorry, I bad speak English :)
Hi I have used this article for multiple upload files and now I have some problems with update files without replace.
https://www.codementor.io/tips/8367241728/carrierwave-now-natively-supports-multiple-file-uploads-in-rails-gotchas
When I update attachments, they to replace in database.
Can someone suggest a good solution for update form without replace?
Thanks
Artsiom Harashchenia
Email: tecktoart@gmail.com
The text was updated successfully, but these errors were encountered: