Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I allow a user to browse/choose a file from device in iOS

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

  • Is iOS developer able to view file systeme
  • How to list all folders and their subdirectories/files in iPhone SDK

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

like image 387
iShwar Avatar asked Sep 26 '13 07:09

iShwar


People also ask

How do I manage files in iOS?

Touch and hold the file or folder, then choose an option: Copy, Duplicate, Move, Delete, Rename, or Compress. To modify multiple files or folders at the same time, tap Select, tap your selections, then tap an option at the bottom of the screen.

How do I explore app files in iOS?

Here's how to browse files on your iOS device:Select your device in iMazing, then click Apps. Select an app, then enter its Backup folder. Navigate that folder to find files. Select files you want to view; you may or may not be able to view them, depending on which apps are needed to read their data.

How do I change permission settings for a folder on Mac?

For example, you can change permission settings for a folder so that other users who log in to your Mac, or connect to it for file sharing, can view but not change files in a folder. On your Mac, select a disk, folder, or file, then choose File > Get Info. If the information in Sharing & Permissions isn’t visible, click the arrow .

How to assign permissions to users and groups on a Mac?

Assign permissions to users and groups 1 On your Mac, select a disk, folder, or file, then choose File > Get Info. 2 If the information in Sharing & Permissions isn’t visible, click the arrow . ... 3 Click a user or group in the Name column, then choose a privilege setting from the pop-up menu. ...

How to apply permissions to all items in a folder or disk?

Apply permissions to all items in a folder or a disk 1 On your Mac, select a folder or disk, then choose File > Get Info. 2 Click the lock icon to unlock it. 3 Enter an administrator name and password. 4 Click the Action pop-up menu , then choose “Apply to enclosed items.”

How do I set privilege settings for a user?

Click a user or group in the Name column, then choose a privilege setting from the pop-up menu. Read & Write: Allows a user to open the item and change it. Read only: Allows a user to open the item, but not change its contents. Write only (Drop Box): Makes a folder into a drop box. Users can copy items to the drop box, but can’t open it.


2 Answers

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

like image 58
Anil Avatar answered Sep 18 '22 05:09

Anil


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.

like image 37
allprog Avatar answered Sep 18 '22 05:09

allprog