# Lo\_export problem

**URL:** <https://www.ruby-forum.com/t/lo-export-problem/108527>\
**Category:** Ruby\
**Created:** [July 4, 2007, 12:46pm UTC](https://www.ruby-forum.com/t/lo-export-problem/108527 "2007-07-04T12:46:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![incoroneta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/a3d4f5/32.png) [@incoroneta](https://www.ruby-forum.com/u/incoroneta)\
**Post date:** [July 4, 2007, 12:46pm UTC](https://www.ruby-forum.com/t/lo-export-problem/108527/1 "2007-07-04T12:46:25Z")

</div>

Hi,

i’m trying to store a picture from the DB to the filesystem.  
i’ve used the function lo\_export like that:

res = conn.query(“SELECT nome,physical\_image FROM images;”)

i=0  
while(res[i]!=nil)  
conn.lo\_export(res[i][1].to\_i,’/home/andrea/senior/public/images/#{res[i][0]}.jpg’)  
i+=1

end

conn.close())

there’re not errors, the script run…  
The problem is that no files are created and i don’t know why.  
Can somebody help me??

thanks in advance…

---

<div class="post-metadata">

**Author:** ![incoroneta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/a3d4f5/32.png) [@incoroneta](https://www.ruby-forum.com/u/incoroneta)\
**Post date:** [July 4, 2007, 5:08pm UTC](https://www.ruby-forum.com/t/lo-export-problem/108527/2 "2007-07-04T17:08:24Z")

</div>

On Jul 4, 2007, at 5:48 AM, incoroneta wrote:

> conn.lo\_export(res[i][1].to\_i,'/home/andrea/senior/public/images/#  
> Can somebody help me??
> 
> thanks in advance…
> 
> –  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

Check out the IO and File libraries.  
ri File  
ri IO  
also, in Ruby it’s a good idea to put spaces before and after  
operators…  
i += 1
