views:

372

answers:

1

Hello,

I am developing an app that will upload the image from the iphone to a server. In server side there is a php program to handle the uploaded image. I am using the NSURLConnection with the Post method and have set the post body of the request. When I upload the image, I could see the image uploaded 3 times(in the server), but after sometime didFailWithError: is called stating that "lost network connection". What could be the reason for this? My doubt is that why is that image is uploaded multiple times? I have set the timeout of the request to 3600.0

Any help is appreciated.

Thanks

A: 

How does your server respond to the upload? What status does it return to the client? If it accepts the image then resets the connection without replying to the POST request, you'll see the behaviour you've described.

Graham Lee
Thanks Lee.. It returns the error code -1005. And also connection:didReceiveREsponse is not called.
samben
I meant which of these statuses is returned by the server: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
Graham Lee
I don't get any of the status message. This will be included in the server's response right? I am not getting the server's response at all. Infact, servers's response will be in didReceiveREsponse method. Since this is not called I am not able to figure out response code.
samben
Right, but you have server logs?
Graham Lee
No. But in the php script there is a code snippet that will write a log to a text file whenever the request is made. And when i see the log, i could see the result 3 times at a gap of 6-7 secs.
samben