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 ..
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 ..
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.
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.
NSFileManager Class
Discovering Directory Contents – mountedVolumeURLsIncludingResourceValuesForKeys:options: – contentsOfDirectoryAtURL:includingPropertiesForKeys:options:error: – contentsOfDirectoryAtPath:error: – enumeratorAtPath: – enumeratorAtURL:includingPropertiesForKeys:options:errorHandler: – subpathsAtPath: – subpathsOfDirectoryAtPath:error: