Uploading images to a server using an iPhone - iphone

How can I upload multiple files to a server using an iPhone, without error?
I am using HTTP for uploading images but some of images are missing.

The ASIHTTTRequest library's ASIFormDataRequest method allows you to easily attach images to your post with a simple line of code for each imag, doing the whole thing asynchronously with simple success and failure delegate methods.
Just a suggestion. Posting your code is essential if you want to use your own code instead.

Related

How to get serverside file uploading progress in Perfect

I'm trying to create a web page using Perfect(perfect.org), Where users will browse and upload files. Can anyone tell me how can I get the progress of file upload?
perfect.org-fileUploads
Refer above link and Do as-usual concept following in HTML-JS-PHP or HTML-JS-JSP or other programming
In other words
you can receive response status in percentage from server-side and display it to client or put loder while uploading the file
Thank you
Before an official solution released from PerfectlySoft Inc. for this feature request, you could try splitting the file into small pieces and upload them one by one, then merge them back to the server - since there is no such an industrial standard to apply, all other web servers either provide different solutions or simply stay away from it.

What's the best way to download multiple images and display multiple UIImageView?

I need to download images from a website and display them on(?) multiple UIImageView.
Maybe I'll code a php to "read" the directory and search for images, write a XML file and use it as medium. But I'm not sure if it's the best way.
Let's see the options you have to fetch images from a website:
Fetching HTML and Parsing the HTML to find the images (on the iphone). Then downloading the images.
Writing a script (maybe PHP) that writes all image links to an XML file (or JSON), and then fetch the output of your script with all the links.
If you choose option (1) you'll need NSURLConnection to fetch data asynchronously (without blocking the UI). I would also use TFHpple to parse HTML using xpath queries, see this tutorial for help. Finally to fetch the images using their URLs you can use SDWebImage, SDWebimage also provides caching so your app will not download the same image multiple times.
The bad side of using option (1) is that any change in the Website you're getting the images from will break your app and you'll need to issue an update to the app store in order to fix it.
If you choose option (2), your app will be easier to fix if the website changes, you'll just need to modify your script.
If you go with option (2) you'll probably need NSURLConnection, NSXMLParser (or a third party XML parsing library) and to download the images I would recomend SDWebImage again. I would also advise using JSON (and NSJSONSerialization) instead of XML, just beacuse I find JSON easier to parse.
Yes, it will be very good if you write some php script to get image list (list of image urls).
After getting such urls you can asynchronously download and show them in image views. Look here for such async image view implementation

uploading image to server in iphone and show progress bar....?

i am making an app in which i have to upload an image/video file to the server...i want to know what things i needed to do this..?and i also have to show the progress bar while image is uploading...how can i do this..?
can you write some code snippet on how to upload file to server...?
If you are using http to transfer files.Allseeing-i have a great api for this called ASIHTTPRequest, its feature rich, well documented, easy to use and it supports file transfer tracking.
They have code examples and a description on how to include it in your projects.

Select a file on an iPhone

I want the user to select a file from an iPhone and upload to an HTTP server.
Example: The GoodReader application has this feature in it.
How can this be done?
You can't get all the files stored on the phone.
As the comment from Stephen Darlington states, your app is sandboxed and can only get to the files stored inside your app.
You could register your app to be able to open PDF, txt, doc and other files that you are interested in sending to your server and then users would be able to open these documents in your app. Once the files are inside your app you could then use any number of ways to upload them.
Please read the documentation here about registering your app to understand file types:
Registering the File Types Your App Supports
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 reference:
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:

Options for transferring file to iPhone/iPad

I'm working on an app and need to add the ability to import CSV files into the app for processing. What are the options here? I've read posts about embedding http servers or fetching a CSV file from a web resource, but what is the easiest way to do this?
thanks
I've used NSData's dataWithContentsOfURL: just recently; it worked fine. Plus there's a convenient writeToFile:atomically: or writeToFile:options:error: message you can send to your data object.