Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Is there a file selector in corona sdk?
Started by NagyAbel Dec 14 2019 02:45 AM

* * - - - 3 votes
21 replies to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

NagyAbel

[GLOBAL: userInfoPane.html]
NagyAbel
  • Observer

  • 9 posts
  • 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?



[TOPIC: post.html]
#2

pixec

[GLOBAL: userInfoPane.html]
pixec
  • Contributor

  • 154 posts
  • Corona SDK

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

[TOPIC: post.html]
#3

NagyAbel

[GLOBAL: userInfoPane.html]
NagyAbel
  • Observer

  • 9 posts
  • Corona SDK

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



[TOPIC: post.html]
#4

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Corona Geek

  • 1,169 posts
  • Corona SDK

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


  • pixec likes this

[TOPIC: post.html]
#5

NagyAbel

[GLOBAL: userInfoPane.html]
NagyAbel
  • Observer

  • 9 posts
  • Corona SDK

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.

[TOPIC: post.html]
#6

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Corona Geek

  • 1,169 posts
  • Corona SDK

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.



[TOPIC: post.html]
#7

sporkfin

[GLOBAL: userInfoPane.html]
sporkfin
  • Contributor

  • 768 posts
  • Corona SDK

@NagyAbel

 

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



[TOPIC: post.html]
#8

Quantumwave

[GLOBAL: userInfoPane.html]
Quantumwave
  • Contributor

  • 125 posts
  • Corona SDK

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



[TOPIC: post.html]
#9

NagyAbel

[GLOBAL: userInfoPane.html]
NagyAbel
  • Observer

  • 9 posts
  • Corona SDK

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

[TOPIC: post.html]
#10

NagyAbel

[GLOBAL: userInfoPane.html]
NagyAbel
  • Observer

  • 9 posts
  • Corona SDK

is there a plugin already made for this?



[TOPIC: post.html]
#11

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Corona Geek

  • 1,169 posts
  • Corona SDK

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.


  • pixec likes this

[TOPIC: post.html]
#12

pixec

[GLOBAL: userInfoPane.html]
pixec
  • Contributor

  • 154 posts
  • Corona SDK

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

[TOPIC: post.html]
#13

NagyAbel

[GLOBAL: userInfoPane.html]
NagyAbel
  • Observer

  • 9 posts
  • Corona SDK

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



[TOPIC: post.html]
#14

Quantumwave

[GLOBAL: userInfoPane.html]
Quantumwave
  • Contributor

  • 125 posts
  • Corona SDK

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.



[TOPIC: post.html]
#15

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Corona Geek

  • 1,169 posts
  • Corona SDK

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.



[TOPIC: post.html]
#16

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,605 posts
  • Enterprise

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



[TOPIC: post.html]
#17

NagyAbel

[GLOBAL: userInfoPane.html]
NagyAbel
  • Observer

  • 9 posts
  • Corona SDK

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

[TOPIC: post.html]
#18

luantiang

[GLOBAL: userInfoPane.html]
luantiang
  • Enthusiast

  • 36 posts
  • Corona SDK

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.



[TOPIC: post.html]
#19

pixec

[GLOBAL: userInfoPane.html]
pixec
  • Contributor

  • 154 posts
  • Corona SDK

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

[TOPIC: post.html]
#20

carloscosta

[GLOBAL: userInfoPane.html]
carloscosta
  • Contributor

  • 685 posts
  • Corona SDK

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.



[TOPIC: post.html]
#21

NagyAbel

[GLOBAL: userInfoPane.html]
NagyAbel
  • Observer

  • 9 posts
  • Corona SDK

Thanks for the answers.I think that i found the plugin.



[TOPIC: post.html]
#22

vondes

[GLOBAL: userInfoPane.html]
vondes
  • Observer

  • 2 posts
  • Corona SDK

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.




[topic_controls]
[/topic_controls]