1-RestKitクライアントでNSMutableDictionaryを使用して画像を含めるにはどうすればよいですか?
私のサーバーは、以下のコードでNSMutableDictionaryからデータを受信します。
NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init];
[dictionary setObject:usernameTextfield.text forKey:@"username"];
[client put:@"/main/insert" params:params delegate:self];
しかし、どうすれば同時に画像を添付できますか?
一方、RKParamsはサーバー側では機能しません。
RKParams *params=[[RKParams alloc]init];
imageData = UIImagePNGRepresentation(imageField.image);
[params setData:imageData MIMEType:@"image/png" forParam:@"image"];
残りのサーバーコード:
public function insert_put()
{
$username = $this->put('username');
$this->model->insertPost($username);
//Question number 2.
$data['success'] = 'added successfully';
$this->response($data, 200);
}
2-サーバー(php)からどのように受信できますか?私はこれにプットオプションを使用しています。