6

I want to allow the user to upload the files in my iOS application just like the way we upload a particular file in desktop applications with browsing through the different directories. I did some googling too, but did not find the reliable solution.

Someone says that.

The whole file system is not available, if you're running a non-jailbroken phone. Neither are there filesystem browser controls (for the same reason), However, you can browse the user's photo library, or even take a photo with the camera using UIImagePickerController.

Some questions were like this

From these links and from other sources, I am only confused that can i provide the file browse option to user on button tap. And if yes, then how it can be achieved? Any help will be appreciated.

If the user taps on the Browse button the list should be there like

enter image description here

5
  • That "Some one" is probably correct we don't have any authorization or API that allows file or system tree to become accessible as there is no such thing exist as visible in iPhone. Sep 26, 2013 at 7:24
  • But that image is from Android. That OS has specfic functions that enable this kind of inter application communication. In iOS your application has to implement the required functionality.
    – allprog
    Sep 26, 2013 at 7:41
  • @allprog yeah this image is from adroid version of application i am working , i want to do the same for browsing file in iOS version, So for better understanding i uploaded this image here.
    – iShwar
    Sep 26, 2013 at 7:48
  • Did you find the solution for this problem?
    – user3441799
    Nov 3, 2014 at 13:21
  • @Tommy till the day i didnt find any reliable solution for this functionality, Today also i came across the same requirement and started googling....
    – iShwar
    Mar 1, 2017 at 11:31

4 Answers 4

7

iPhone apps are sandboxed. This means that you can only access files/folders inside your AppBundle (like Documents, Cache and the like). That is what the above mentioned URLs are suggesting. You can only upload/download data from/to these folders.

Now if you have a jailbroken phone, its a different scenario. Not going into that.

Check this link out:

Apple iOS Environment under that The App Sandbox

0
4

There is no standard control for this purpose, but using the methods mentioned in the posts you referenced, populating a table view is perfectly doable. Keep in mind that this will allow you to view the files in your application's sandbox. You cannot access files of other applications.

Alternatively, you can use open source libraries like the ios_file_browser or the iOS-File-Browser. These provide user interface and you can check out the implementation as well.

2

Starting in iOS 8, you can use UIDocumentPickerViewController, "a view controller that provides access to documents or destinations outside your app’s sandbox":

https://developer.apple.com/documentation/uikit/uidocumentpickerviewcontroller

0

I'm an author of FileExplorer control which is a file browser for iOS. It allows you to browse files and directories that are placed inside your sandbox in a user-friendly way.

Here are some of the features of my control:

  1. Possibility to choose files or/and directories if there is a need for that
  2. Possiblity to remove files or/and directories if there is a need for that
  3. Built-in search functionality
  4. View Audio, Video, Image and PDF files.
  5. Possibility to add support for any file type.

You can find my control here.

1
  • Augustyniak : thanks for the answer but i want to allow user to browse through root directory not through the files inside app bundle only!!
    – iShwar
    Mar 7, 2017 at 7:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.