views:

68

answers:

3

I want user to select file from iphone and upload to a http server. example:: GoodReader application has feature in it. Please help me how this can be done.

Thanks in advance ..

A: 

The file list would just be a UITableView, probably with a custom UITableViewCell.

There are a number of options for uploading data to a web service. The built-in way would be to use NSURLConnection. There are some open source frameworks that may be able to help but I have not used them.

Stephen Darlington
How to get the files list stored on the iphone ????????????????
Gyani
Huh? What files? Presumably you put them there in the first place. iOS is sand-boxed so you can't see files created by other applications.
Stephen Darlington
I want the list of files like .pdf .txt .doc and other files stored in iphone.
Gyani
You can't, at least not if you want to publish in the App Store. Your app runs in a sandbox and does not have access to documents created by other apps. It's not like a Mac or a PC where there's a "Documents" folder.
Stephen Darlington
A: 

The best way that I've found to upload images is to use the ASIHTTPRequest API. Here is a link on the documentation on POSTING data to a server. Download ASIHTTPRequest here and these are the setup instructions.

How to select a file depends on what kind of file you're trying to select. If you're trying to upload images you should look into a UIImagePickerController and UIImagePickerControllerDelegate. If not, you'll have to create a NSFileManager to search through your application's files.

MishieMoo
UIImagePickerController and UIImagePickerControllerDelegate is used for selecting images and NSFileManager to search through our application's files.I want to user to select other files such as pdf and doc files stored in iphone.
Gyani
A: 

NSFileManager Class

http://developer.apple.com/iphone/library/documentation/cocoa/reference/foundation/Classes/NSFileManager_Class/Reference/Reference.html

Discovering Directory Contents – mountedVolumeURLsIncludingResourceValuesForKeys:options: – contentsOfDirectoryAtURL:includingPropertiesForKeys:options:error: – contentsOfDirectoryAtPath:error: – enumeratorAtPath: – enumeratorAtURL:includingPropertiesForKeys:options:errorHandler: – subpathsAtPath: – subpathsOfDirectoryAtPath:error: