Map<String,String> map = new HashMap<String,String>();
map.put("content", matter.content);
String json;
if(matter.file!=null)
{
json = httpPost(API_URL+"Matter/Publish",map,new File(matter.file));//这段代码提交图片文件
}else
{
json = httpPost(API_URL+"Matter/Publish",map);
}TP端我是采用如下方式接收的import("ORG.Util.FileUpload");
$file = $_GET['file'];
$savePath = date('Y/m', time());
$up = new FileUpload(array('israndname'=>true, 'savepath'=>'./Upload/images/'.$savePath));
$up->uploadFile($file);
if('' != $up->getErrorMsg()) {
//捕获上传异常
$this->error($up->getErrorMsg());
} else {
//取得成功上传的文件信息
$f = $up->getUploadFileName();
$arr['file'] = $f;
$matter = D('Matter');
$pkid = $matter->addOne($arr);//这段是将文件路径写入数据库写入后,发现上传文件夹/Upload/images/里没有图片,数据库里也只存储了“/Upload/images/+日期”内容,请问下,该如何获取图片,谢谢各位帮忙。 最佳答案