request.raw_post into Tempfile

i have flash application ,which will give a jpg file as raw_post

from that raw_post i am trying to store into a tempfile

tempfile=Tempfile.new("myfile.jpg") tempfile.write(request.raw_post)

but always "tempfile.read" giving ""(not storing the data) as output

i don't why ?

any help ?