Hello,
I'm working on an import utility that will match the functionality of uploading an object of a model that uses attachment_fu for thumbnailing, etc.
Rather than uploading the file via a form, I want to populate the params[:image][:uploaded_data] with data from a file already on the server's file system.
So far, I've been able to copy to an instance of Tempfile via the copy_to_temp_file method I jacked from attachment_fu and pass that as the value of :uploaded_data, but attachment_fu is still not happy. The Tempfile created via a multipart form and a browser has content_type set, as well as having the path be how the object is identified (i.e. - #<File:/tmp/file/path>).
I feel like I've either reached a dead end and I have to explore setting size, original_filename, and content_type explicitly in the new method parameters or that I'm just bumping up against my ignorance and there is a better way I don't know about.
Recommendations?
I noticed that there are mechanisms for this fake out in testing code, perhaps I'll give them another look.
Cheers, Walter McGinnis http://blog.katipo.co.nz/