【发布时间】:2014-08-11 07:59:08
【问题描述】:
我正在通过 MKnetwork 将图像发送到 php 服务器...在 php 端,图像是在 $_POST 而不是 $_FILES 中接收的...这是我在 ios 端的代码
UIImage *image = [UIImage imageWithContentsOfFile:fullImgPath];// fullpath contains the path of image
NSData *imageData = UIImageJPEGRepresentation(image, 0.0);
MKNetworkEngine *engine=[[MKNetworkEngine alloc]initWithHostName:nil];
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
[dict setValue:imageData forKey:@"uploadedfile"];
NSString *url=@"http://ilogiks.co.uk/demo/image/upload.php";
MKNetworkOperation *op=[engine operationWithURLString:url params:dict httpMethod:@"POST"];
从php端
echo "POST";
var_dump($_POST);
echo "FILES";
var_dump($_FILES);
$_FILES 显示空图像,$_POST 显示以下响应
array(1){
["uploadedfile"]=>
string(50523) "<ffd8ffe0 00104a46 49460001.............
我希望在 $_FILES 中接收图像以便我可以保存它,或者是否有其他解决方案可能?请帮忙
【问题讨论】:
标签: php ios image-uploading mknetworkengine