attachment_fu and get file from session.

Hello,

I'm using the attachment_fu right now and I don't know how to get the image from session to the browser, before I'll save it. How to output uploaded_data to the browser?

(I think there are two ways: 1) saving into the temporary file; 2) or get it straight from the action; )

Dmitry

Hi Solid. Sorry, could you repeat your question? Attachment_fu automatically knows how to read the "uploaded_data" part in the file field.

Sorry that I were not able to describe my problem a bit better.

I have two controllers questions and answers. When I'm creating a new question, I need to add some answers to this question. So I'm going to the answer controller and adding some answers with some images to the *session*, because I don't want to save answers at this moment (maybe a question will not be created, and also for the easy save... for example: @questions.answers = session[:answers] @question.save). So I'm adding my answers to the session... and when I'm trying to edit this temporary answers, I need to show images for every answer.

The question: how can I output images from the temporary (session) answers?

I see only two ways how to do that, but maybe that isn't a best practice.

1) save uploaded_data to a temporary file (the problem, sometimes we need to cleanup the temporary folder); 2) output from some answer action, for example named "temporary_image" the uploaded_data to a browser.

Thank you again, Dmitry