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?
Jump to content
You just need to perform a quick Google search (or just peruse the documentation) to find pages like:
If you're building a desktop app then this is the file dialog you're looking for:
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.
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.
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.
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.
PS> Note that I have not tried all of them yet myself.
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.
I cannot log in to the Google Marketplace. It demands to reconfirm my postal address. It looks like I have stated the wrong zip code when sighing up. Now I check over here the correct zip code. But how to amend it in my details. Do you think it will be better to create a new account and forget about the old one? Or is there any chance to contact a support team? Any help will be much appreciated.