# Attachment\_fu and get file from session

**URL:** <https://www.ruby-forum.com/t/attachment-fu-and-get-file-from-session/110331>\
**Category:** Rails\
**Created:** [July 25, 2007, 12:55pm UTC](https://www.ruby-forum.com/t/attachment-fu-and-get-file-from-session/110331 "2007-07-25T12:55:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Solid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/7cd45c/32.png) [@Solid](https://www.ruby-forum.com/u/Solid)\
**Post date:** [July 25, 2007, 12:55pm UTC](https://www.ruby-forum.com/t/attachment-fu-and-get-file-from-session/110331/1 "2007-07-25T12:55:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Solid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/7cd45c/32.png) [@Solid](https://www.ruby-forum.com/u/Solid)\
**Post date:** [July 25, 2007, 6:42pm UTC](https://www.ruby-forum.com/t/attachment-fu-and-get-file-from-session/110331/2 "2007-07-25T18:42:08Z")

</div>

Hi Solid. Sorry, could you repeat your question? Attachment\_fu  
automatically knows how to read the “uploaded\_data” part in the file  
field.

On 7/25/07, Solid [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Dmitry
> 
> >

–  
Ramon T.

---

<div class="post-metadata">

**Author:** ![Solid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/7cd45c/32.png) [@Solid](https://www.ruby-forum.com/u/Solid)\
**Post date:** [July 25, 2007, 10:51pm UTC](https://www.ruby-forum.com/t/attachment-fu-and-get-file-from-session/110331/3 "2007-07-25T22:51:56Z")

</div>

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

On Jul 25, 7:41 pm, “Ramon Miguel M. Tayag” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
