0

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

samben
  • 23
  • 2
  • 8

2 Answers2

5

In my case, i have forgot to set method to POST like this:

    [aRequest setHTTPMethod:@"POST"];

Hope it helps

Furkan Mustafa
  • 794
  • 7
  • 12
0

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.

  • Thanks Lee.. It returns the error code -1005. And also connection:didReceiveREsponse is not called. – samben Sep 07 '09 at 08:20
  • I meant which of these statuses is returned by the server: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html –  Sep 07 '09 at 10:22
  • 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 Sep 07 '09 at 14:31
  • 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 Sep 07 '09 at 17:03