Reputation: 7161
Working on iPhone app that takes a photo and then uploads it to a server. The server is in working condition, tested the same by uploading image from android app.
Below is the code snippet
NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@", FORM_BOUNDARY];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url];
[request setHTTPShouldHandleCookies:NO];
[request setHTTPMethod:@"POST"];
[request setValue:contentType forHTTPHeaderField:@"Content-Type"];
[request setValue:[NSString stringWithFormat:@"%d", [data length]] forHTTPHeaderField:@"Content-Length"]
[request setHTTPBody:data];`
////
But i get following response from the sever
HTTP Status 600 - java.lang.NullPointerException
type Status report
message java.lang.NullPointerException
description Cannot find message associated with key http.600
Apache Tomcat/6.0.18
////
I suppose error 600 might be user defined. Is there some tag being missed? Please suggest.
Upvotes: 0
Views: 7603
Reputation: 17877
As you wrote it is server error: HTTP Status 600 - java.lang.NullPointerException
.
Moreover http status code >= 400 means that there are now problems in your request but there are problems on server side.
If you are server admin - try to debug server, for example, print post arguments.
I don't see problems in posted obj-C code.
P.S. I could just advice you to use highly populated ASIHttpRequest
framework. It could handle file upload by itself. It is very easy and safe to use it.
Upvotes: 2