【发布时间】:2013-08-19 14:10:32
【问题描述】:
在将图像上传到 PHP 服务器时,我以这种方式将其作为文件发送:
entity.addPart("image_file", new FileBody(new File(file_path)));
httppost.setEntity(entity);
但是在服务器端我得到了错误:
您尝试上传的文件类型不允许
因为正在发送的数据是:
[image_file] => Array
(
[name] => IMG_20130801_124102.jpg
[type] =>
[tmp_name] => C:\wamp\tmp\php37E.tmp
[error] => 0
[size] => 2084727
)
类型没有价值。
据我所知,它应该会自动进行。还是我应该把它设置在某个地方?
【问题讨论】:
标签: php android image-uploading