FTP and HTTP upload on iPhone

In my iPhone application, I need to upload images to the server. I'm not really worried about safety and materials, I just need a fast and reliable method. I can embed my image data in an HTTP request, or I can create an FTP connection to the server (using Apple's SimpleFTPSample). The disadvantage of each method is: - HTTP: timeout if the image is too large without renewing, and there is no way to find out the download progress (%)? - FTP: sometimes I got NSStreamEventErrorOccurred and I don’t know why (when testing on the device, on the simulator it works fine. Maybe 3G errors?)

My question is: do you have any experience with this problem (upload image to server)? Which method do you recommend? FTP, HTTP or another method? Thanks in advance.

+3
source share
5 answers

Finally, I continue to use HTTP and use the following delegate method to track the download process:

- (void)connection:(NSURLConnection *)connection didSendBodyData:(NSInteger)bytesWritten totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite

totalBytesWritten / totalBytesExpectedToWrite gives me the percentage of load.

+1
source

Fast, easy and reliable: ASIHTTPRequest , and you can track download progress.

+2
source

- (IE: iPhone Android-). Java, POST . Objective-C (iPhone/iPad) Java (Android) .

+1

, FTP-, HTTP POST.

0
source

Third option: if you manage the target server, you must create your own protocol for sending data. This can provide you with the flexibility of your desire by having to deal with lower functions.

0
source

Source: https://habr.com/ru/post/1723690/


All Articles