Php iOS obj-c将图像上传至mysql,AFJ网络

Php iOS obj-c将图像上传至mysql,AFJ网络,php,ios,mysql,Php,Ios,Mysql,我一直在寻找一个关于如何上传一个图像到mysql数据库与php上的php服务和iOS应用程序使用objective c 有人能给我指出一些我能从中学到的东西吗?我被困在这里了 到目前为止,这是我所理解的 将图像转换为base64String base64StringImage = [UIImageJPEGRepresentation(SelectedImage,1.0) base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterL

我一直在寻找一个关于如何上传一个图像到mysql数据库与php上的php服务和iOS应用程序使用objective c

有人能给我指出一些我能从中学到的东西吗?我被困在这里了

到目前为止,这是我所理解的

将图像转换为base64String

base64StringImage = [UIImageJPEGRepresentation(SelectedImage,1.0) base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength];
我知道如何像这样将字符串传递给php

NSString *string = [NSString stringWithFormat:@"http://***********/imageupload/ios_upload.php?Image64String=%@&ImageName=%@",base64StringImage,ImageName];

        NSURL *url = [NSURL URLWithString:string];
        NSURLRequest *request = [NSURLRequest requestWithURL:url];
        AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
        operation.responseSerializer = [AFJSONResponseSerializer serializer];
但它不起作用,我如何将base64String传递给php以便在那里解码

试试这段代码

NSData *imageData = UIImagePNGRepresentation([UIImage imageNamed:@"myFile.png"], 1.0);

[request setData:imageData withFileName:@"ImageName.png" andContentType:@"image/png" forKey:@"uploadKey"];