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
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.
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.
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 .
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. ...
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.”
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.
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With