Is there a file selector in corona sdk?

I want to make an app where the user can take a document and putting in to the app,that is going to display in text.

Is there any way to make a file picker/selector or is it already done?

Its been done at least a thousand times already but you can do so by using corona’s lua file system.

Thanks for the answer,can you share me a demo or something,becouse i dont know how to start.

You just need to perform a quick Google search (or just peruse the documentation) to find pages like:
https://docs.coronalabs.com/guide/data/readWriteFiles/index.html

https://docs.coronalabs.com/api/library/lfs/index.html

https://docs.coronalabs.com/guide/data/LFS/index.html

I know already about these documents but i cant
make a file explore/selector or i dont know how
its called. I need a demo or help how to create.

If you need to access files outside of your app, you’ll need to use corona native. If you don’t even know what to google for, then I would pursue some easier project first so that you can learn a bit more first.

@NagyAbel

What is the format of the files you are trying to access?  Your solution will be dependent on the format for sure.

If you’re building a desktop app then this is the file dialog you’re looking for:

https://marketplace.coronalabs.com/corona-plugins/tiny-file-dialogs

Im trying for android/ios. I need to open text files and then putting that text files to a text object in corona

is there a plugin already made for this?

If those text files will be inside of your Corona app’s documents (or other) folder, then all you need are still those links I provided. If you need to scan for text files in other places, then you’ll need to go native (or perhaps find a plugin from the marketplace).

In other words:

  1. Use lfs to find files in your app’s directories, or use a plugin or some native means to find files in other directories or SDs, etc.

  2. Read the file,

  3. Do what you want.

What do you want OP? Do you want to get files from inside the app folders or elsewhere?

I want to get the file from outside of the app,can someone link me a plugin to this?

With app sandboxing on iOS and Android, your app is not allowed to access files outside of your app’s sandbox.

It is possible to load remote files into your sandbox directories though, if that’s an option for you.

There is native support for loading them, and there are plugins that already do this in the marketplace. The OP could just search the marketplace and they’ll find several.

Let’s take a quick step back here. This is mostly directed to the OP who’s asking the question.

Mobile devices have a different User Interface (UI) paradigm than Desktop apps do, which is different than TV apps.

For mobile (Android, iOS), you’re generally limited to the files in your App’s sandbox (though Android does have the concept of External storage), but generally those OS’s do not present a File Explorer/Finder type of dialog box. Instead, a list of files would be added to a tableView and then the rows in the tableView would be interacted with and a new scene could show the contents of the selected file. There won’t be a dialog here. You would use LFS, get the list of the files in the folder where they are stored, insert each file into tableView. Corona can do this with ease. You’re not going to give people the ability to search the whole hard drive looking for files. You will have one or two possible locations for these files.

For desktop (Windows, macOS), your menu would likely have a File->Open or a File->Save As or other similar actions in a menu (or respond to keystrokes like CTRL-S/CMD-S). The dialog pop’s up over the rest of the UI, takes complete focus of the input. You can pretty much navigate to any folder that you have access to, organize content with sub-folders, etc. This doesn’t work for Mobile. To build this in Corona would be very difficult. We don’t have API’s to directly open the operating system’s file picker. This is where the tiny-file-dialog plugin comes into play. If you’re building a desktop/laptop app, you will want to use this. If you’re building a mobile app you do not.

Rob

Thank you, so there isnt any way to open files from outside of the app.

Hello NagyAbel,

You can try these on Corona Marketplace, https://marketplace.coronalabs.com/search?keyword=storage

Please read the documentation on the respective plugin, to see if they suit your requirement and/or their targeted usage, and/or any limitation. Documentation is under “Additional Information” when you click on the respective plugin. If necessary, you can contact the respective owners, under “Vendor” when you click on the respective plugin.

Hope this helps.

Luan

PS> Note that I have not tried all of them yet myself.

Yes there is a way! Many have said so and you ignore them! Google! Search marketplace! Search docs! READ WHAT PEOPLE SAY! :smiley:

You can’t access outside sandbox app for both OS with Corona.  There are plugins that can help you on that. Some for Android others for IOS.

But the question here is, how the file will put in the device in the first place? You just can’t copy a file on IOS, on Android most phones don’t have expanded memory, so my guess is are you going to retrieve the files from a cloud like google drive or iCloud? You can search plugins for both. For iCloud I know there are 1, and for drive there was one.

Don’t know if its going to be for a business app or just for fun to get files from the device.

If it’s for business…easy to do is have a backoffice to upload files to a remote server. Just use JSON to get those files.

It’s hard to help when you give so little information about the project. For your specific question in the first post, the short answers i NO, you can’t access outside the app sandbox.