how to copy image file on android devices

when i try the under function in win,it worked.But failed when i build for android devices.

function copyFile( srcName, srcPath, dstName, dstPath )  
  
 local results = true -- assume no errors  
  
 -- Copy the source file to the destination file  
 --  
 local rfilePath = system.pathForFile( srcName, srcPath )  
  
 local wfilePath = system.pathForFile( dstName, dstPath )  
  
 local rfh = io.open( rfilePath, "rb" )  
  
 local wfh = io.open( wfilePath, "wb" )  
 if not wfh then  
 print( "writeFileName open error!" )  
  
 results = false -- error  
  
 else  
 -- Read the file from the Resource directory and write it to the destination directory  
 local data = rfh:read( "\*a" )  
  
 if not data then  
  
 print( "read error!" )  
 results = false -- error  
  
 else  
 if not wfh:write( data ) then  
  
 print( "write error!" )  
 results = false -- error  
  
 end  
 end  
 end  
  
 -- Clean up our file handles  
 rfh:close()  
 wfh:close()  
  
 return results  
end  

[import]uid: 45977 topic_id: 21671 reply_id: 321671[/import]

You might have not added the correct Android permissions. Trying adding the WRITE\_EXTERNAL\_STORAGE permission. It is either that or your code may be incorrect. Good luck and I hope this helps.

Regards,
Jordan Schuetz
Ninja Pig Studios [import]uid: 29181 topic_id: 21671 reply_id: 85979[/import]

however,i can copy .txt file successed. [import]uid: 45977 topic_id: 21671 reply_id: 86542[/import]

Where are the image files you’re trying to copy? I think the issue is the way corona packs them to handle the sub directory stuff. [import]uid: 8872 topic_id: 21671 reply_id: 86631[/import]

I too am having issues on Android with the same example code. I have added the correct permissions WRITE_EXTERNAL_STORAGE [import]uid: 58885 topic_id: 21671 reply_id: 96760[/import]

copy image from system.ResourceDirectory
[import]uid: 45977 topic_id: 21671 reply_id: 102207[/import]

adding the WRITE_EXTERNAL_STORAGE permission,but it don’t worked [import]uid: 45977 topic_id: 21671 reply_id: 102208[/import]

Please see the following link for details on why this happens and how you can work-around it…
http://developer.anscamobile.com/forum/2011/09/25/application-has-been-corrupted-error#comment-65109
[import]uid: 32256 topic_id: 21671 reply_id: 102209[/import]

Have the right way to do it?
[import]uid: 45977 topic_id: 21671 reply_id: 102605[/import]