remyr3my
remyr3my

Reputation: 778

Add a file into the ios app

I am a newbie to iOS, I have a created a textfield and imageView in a ViewController. I want user of app to select an image or a file(.txt,.csv, etc)into the App. I know that Apple provides UIImagePicker to select images from the device. with these I added an image to my imageView.

Now I want to Know that is there any way to select files from the device and use it into application. Or else Open file system of device and select the file ?

When I Googled it, I got that you are not able to open the file system. So how can I implement this functionality in iOS app?

Upvotes: 1

Views: 939

Answers (4)

Pushkraj Lanjekar
Pushkraj Lanjekar

Reputation: 2294

There is no way of selecting file from file system into application. You can only access files from

  1. Default Photos App
  2. Application Documents Directory
  3. Any file from web server with use of API's

There are multiple ways from which you can select files of different types other than images are

  1. Integrate Dropbox SDK into app
  2. Integrate Google Drive
  3. Integrate iCloud

So create one UIButton like "Select File" and open UIActionSheet on tap of it. UIActionSheet will have options like

  1. Select From Photos
  2. Select File From Dropbox
  3. Select File From iCloud
  4. Select File From Google Drive etc

And you can call respective actions on each index.

Upvotes: 1

Arkhan
Arkhan

Reputation: 56

you can not load files directly from file system, but you can load them from some third party applications like Documents and cloud sources like iCloud and Drop Box with UIDocumentPickerViewController

Upvotes: 0

You can use UIDocumentPickerViewController if you enable iCloud document support for your app.

Upvotes: 0

Avineet Gupta
Avineet Gupta

Reputation: 596

You can pick your documents and images and other files by using separator picker for each like

for Documents - UIDocumentPickerViewController

for Images/Videos - UIImagePickerController

Apple does not provide a direct picker for all files. Hope this is working for you. :)

Upvotes: 0

Related Questions