how know if an image exits?

How can I use a IF to check if an image are in my system.DocumentsDirectory?

Try something like this:

1
2
3
4
5
6
7
8
9
10
local function doesFileExist(filename)
    local path = system.pathForFile( filename, system.DocumentsDirectory)
    local file = io.open( path, "r" )
    local fileExists = false
    if file then
         io.close( file )
         fileExists = true
    end
    return fileExists
end
views:1547 update:2011/10/29 17:13:10
corona forums © 2003-2011