1
서버로 이미지를 업로드 할 때 문제가 있습니다. 500 Internal Server Error
이됩니다.500 내부 서버 이미지 업로드시 오류가 발생했습니다.
I는 다음 코드 이미지를 업로드있어
ASIFormDataRequest *request=[ASIFormDataRequest requestWithURL:url];
[request setRequestMethod:@"PUT"];
[request setPostValue:[[NSUserDefaults standardUserDefaults]valueForKey:@"nickname"] forKey:@"nick"];
NSData *imageData = UIImagePNGRepresentation(img.image);
[request addData:imageData withFileName:@"image.png" andContentType:@"image/png" forKey:@"image"];
//[request setData:imageData withFileName:@"profileImage.jpeg" andContentType:@"image/jpeg" forKey:@"image"];
[request setDelegate:self];
[request setDidFinishSelector:@selector(requestSuccess:)];
[request setDidFailSelector:@selector(requestFailed:)];
[request startAsynchronous];
및 답변
-(void)requestSuccess:(ASIFormDataRequest *)request{
NSLog(@"%@",[request responseData]);
NSError *error;
NSString* newStr = [[[NSString alloc] initWithData:[request responseData]
encoding:NSUTF8StringEncoding] autorelease];
NSDictionary *dict=[NSJSONSerialization JSONObjectWithData:[request responseData] options:NSJSONReadingAllowFragments error:&error];
NSLog(@"%@",error);
}
우선도 NSdictionary
데이터를 JSON
데이터 변환에 에러가 있으며,이를 통해 오류
Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)" (Invalid value around character 0.) UserInfo=0x8563f70 {NSDebugDescription=Invalid value around character 0.}
그럼 확인하려고 시도했습니다.있는 NSString에서데이터는 위 나는 문제가 될 수있는
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>500 Internal Server Error</title>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>
응답
에 문자열 아래 얻고 그렇게함으로써 수행으로?