Tag: webserver

使用PHP在ios上通过JSON在web服务器上上传图片

我有一个在web服务器上传用户数据的应用程序。 我正在使用下面的代码将数据传递给Web服务器与下面的代码。 -(IBAction)btnRegister:(id)sender { jsonSP = [SBJSON new]; jsonSP.humanReadable = YES; NSString *service = @"/register.php"; NSData *imageData = UIImagePNGRepresentation([UIImage imageNamed:@"register_btn.png"]); [Base64 initialize]; NSString *imageString = [Base64 encode:imageData]; NSLog(@"%@",imageString); NSString *requestString = [NSString stringWithFormat:@"{\"?username\"=\"%@\"&\"user_password\"=\"%@\"&\"first_name\"=\"%@\"&\"email\"=\"%@\"&\"profile_photo_link\"=\"%@\"\"}",@"Test",@"Test",@"Test",@"Test@mmm.com",imageString]; NSData *requestData = [NSData dataWithBytes: [requestString UTF8String] length: [requestString length]]; NSString *fileLoc = [[NSBundle mainBundle] pathForResource:@"URLName" ofType:@"plist"]; NSDictionary *fileContents = [[NSDictionary alloc] […]