Php 无法将文件类型发送到服务器
将图像上载到PHP服务器时,我将其作为文件发送,方式如下:Php 无法将文件类型发送到服务器,php,android,image-uploading,Php,Android,Image Uploading,将图像上载到PHP服务器时,我将其作为文件发送,方式如下: entity.addPart("image_file", new FileBody(new File(file_path))); httppost.setEntity(entity); 但在服务器端,我得到一个错误: 不允许您尝试上载的文件类型 因为正在发送的数据是: [image_file] => Array ( [name] => IMG_20130801_124102.jpg
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
)
没有类型的值
据我所知,这应该是自动进行的。或者我应该将其设置在某个位置?您可以检查以下事项:
是的,我查了1<代码>$config['allowed_types']='gif | jpg | jpeg | png'代码>2。对于大小问题,我收到了一条不同的消息:
上传的文件超过了PHP配置文件中允许的最大大小。
改为尝试:entity.addPart(“image_file”、新文件体(新文件(file_路径)、“image/jpeg”);