I am having a problem which has been driving me mad for days now, can someone please help me out here.
I have the below code working…
[lua] pathToDownload = system.pathForFile( “image”…i…".jpg", system.DocumentsDirectory )
myFile = io.open( pathToDownload, “w+b” )
for row in db:nrows(“SELECT * FROM products WHERE mobileId = '”…i…"’ AND colourof = ‘’") do
http.request{
url = “http://www.seltex.co.uk/library/gallery/pic_compression.php?id="..row.id.."&size=100”,
sink = ltn12.sink.file(myFile),
}
end[/lua]
But this is not the way I need it to work, I need the io.open line inside that for loop like I have done below, but for some reason this causes an error and I just cant figure out what the problem is
[lua] pathToDownload = system.pathForFile( “image”…i…".jpg", system.DocumentsDirectory )
for row in db:nrows(“SELECT * FROM products WHERE mobileId = '”…i…"’ AND colourof = ‘’") do
myFile = io.open( pathToDownload, “w+b” )
http.request{
url = “http://www.seltex.co.uk/library/gallery/pic_compression.php?id="..row.id.."&size=100”,
sink = ltn12.sink.file(myFile),
}
end[/lua] [import]uid: 119673 topic_id: 22704 reply_id: 322704[/import]