So you're wanting to add binary data to a plain text CSV file?
I don't think that's possible as-is, since CSV is meant for text
storage, and not binary/blob stuff.
What you can do, is put a filesystem path into the csv and use that
wherever you're parsing the CSV.
I have tried this and the code is working in the local environment with images but when the code is uploaded to a server it is not getting path from the local storage
def attach_image_from_local_path(catalogue, path, row_number)
if File.exist?(path)
filename = File.basename(path)
file = File.open(path)
catalogue.images.attach(io: file, filename: filename)
else
add_error(row_number, “Local file not found: #{path}”)
end
end
it is giving error file does not exist always