我想将图像上传到服务器上的文件夹。图像被发送到objective-c 中的一个方法到一个php 脚本。但是上传没有发生!有什么问题?
这里是 obj-C 方法:
NSURLConnection *getConnection;
NSData *imgData = UIImageJPEGRepresentation(self.imageView.image, 0.7);
NSMutableString *strURL = [NSMutableString stringWithFormat:@"http://.../uploadPhoto.php?ID=2&ph=%@",imgData];
[strURL setString:[strURL stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:strURL]];
[request setHTTPMethod:@"GET"];
getConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self startImmediately:YES];
这里的php脚本:
$ID = $_GET[ID];
$ph = $_FILES['ph'];
$filename =$ID;
move_uploaded_file($ph['tmp_name'], $_SERVER['DOCUMENT_ROOT']."/users/$ID/$filename");
请帮我!