I want to create an instance of "uploaded_file = ActionController::UploadedTempfile" from a File.new("path/to/file"), and then go on to do processing on "uploaded_file" like so:
uploaded_file = ActionController::UploadedTempfile.new(File.new "path/to/file").
But for everything to work correctly, I need to set it so that uploaded_file.original_filename method and uploaded_file.content_type method开发者_运维知识库s work correctly. How do i assign its variables so that it works?
you can set content_type by simply assigning, and to set original_filename, you can do
obj.instance_variable_set "@original_filename", "whatyouwant"
精彩评论