Android File Picker - accessing original file name

Hi all,

I’ve integrated the file picker developed by Scott Harrison and it’s working as expected.  So thanks Scott!

However what I’d like to know is the original  file name that was selected and then copied to the destination path.

When I pass in a nil value like the following:

local pathToSaveOnDevice = system.pathForFile( nil, system.DocumentsDirectory ) androidFilePicker.show("image/\*", pathToSaveOnDevice, function ( ev ) end)

it crashes the app.  So it probably wasn’t designed to work like that.

I basically don’t want to specify a destination file name.  It would be great if passing a nil value would provide the original filename in the call back as part of the event.

There is another plugin called cnkFileManager however it doesn’t appear to be copying files to the destination specified.  This plugin does allow one to pass a nil value when calling system.pathForFile which means the original file name will be used.

Any info would be much appreciated.

Shouldn’t this:

androidFilePicker.show("image/\*", pathToSaveOnDevice, function ( ev ) {})

be this:

androidFilePicker.show("image/\*", pathToSaveOnDevice, function ( ev ) end )

Hey roaminggamer,

Yes is should but I have it in my actual code.  I just wanted to make the call simpler for this topic and forgot to include the ‘end’ statement in this topic.  The braces are from Javascript that I did elsewhere :-)  A habit thing…

I’ll correct it in this topic.  Thanks for picking that up.