Can't Save File Imported With Media.show On Ipad

I’ve been using media.show to let the user select a photo, then I’m saving the photo on my app folder.

It works perfectly on non-iPad devices with this code:

media.show( media.PhotoLibrary, onComplete, {baseDir=system.TemporaryDirectory, filename="screenshot.jpg", type="image"})

I’m saving the image without showing it on screen.

Now, when I run it on iPad the media selector shows up in the top left of the screen, so I need to add the parameters origin and permittedArrows to put the media selector near the button.

And again, the code in the api works ok:

media.show( media.PhotoLibrary, { listener = sessionComplete, origin = myButton.contentBounds } )

But, how can I save the image without showing on the screen?

The docs say

media.show( media.PhotoLibrary, listener, file, origin, permittedArrowDirections ) 

But no matter what, when I add the file parameter, the origin/permittedArrow params stop working and the selector goes back in the top left position.

How am I supposed to do it?
 

Besides, the docs show the syntax like:

media.show( mediaSource, listener )
media.show( mediaSource, listener, file )
media.show( media.PhotoLibrary, listener, file, origin, permittedArrowDirections ) – (iPad only)

while the examples for iPad origin parameter follow a different patter:  

media.show( media.PhotoLibrary, { listener = sessionComplete, origin = myButton.contentBounds } )
so, all parameters inside a table on the second argument?.. and where can I define the file parameter? I’ve tried adding to the table but still doesnt work…

Besides, the docs show the syntax like:

media.show( mediaSource, listener )
media.show( mediaSource, listener, file )
media.show( media.PhotoLibrary, listener, file, origin, permittedArrowDirections ) – (iPad only)

while the examples for iPad origin parameter follow a different patter:  

media.show( media.PhotoLibrary, { listener = sessionComplete, origin = myButton.contentBounds } )
so, all parameters inside a table on the second argument?.. and where can I define the file parameter? I’ve tried adding to the table but still doesnt work…