Android图像上传无法进入PHP脚本

Android图像上传无法进入PHP脚本,php,android,image-uploading,Php,Android,Image Uploading,我正在尝试将一个图像从Android上传到PHP服务器 这是我的上传代码: public static void uploadFile(final String imagePath){ HttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(SERVER); try { File imageFile = new File(imagePath);

我正在尝试将一个图像从Android上传到PHP服务器

这是我的上传代码:

public static void uploadFile(final String imagePath){

    HttpClient httpClient = new DefaultHttpClient();
    HttpPost httpPost = new HttpPost(SERVER);

    try {
        File imageFile = new File(imagePath);

        httpClient.getParams().setParameter(CoreProtocolPNames.USER_AGENT, System.getProperty("http.agent"));

        MultipartEntityBuilder entity = MultipartEntityBuilder.create();

        entity.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
        entity.addPart("image", new FileBody(imageFile));

        httpPost.setEntity(entity.build());
        HttpResponse response = httpClient.execute(httpPost);

        HttpEntity resEntity = response.getEntity();

        BufferedReader reader = new BufferedReader(new InputStreamReader(resEntity.getContent(), "UTF-8"));
        String sResponse;
        StringBuilder s = new StringBuilder();

        while ((sResponse = reader.readLine()) != null) {
            s = s.append(sResponse);
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}
以下是我处理上传的PHP代码:

<?php
    echo "FILES - ";
    var_dump($_FILES);
    echo " REQUEST - ";
    var_dump($_REQUEST);

    $file_path = "images";

    $file_path = $file_path . basename($_FILES['image']['name']);

    if(move_uploaded_file($_FILES['image']['tmp_name'], $file_path)) {
        echo "success";
    } else{
        echo "fail";
    }
?>

我从页面中得到200个响应,但是$\u文件和$\u请求变量都是空的。似乎图像文件没有进入脚本,我不知道为什么。根据我找到的所有教程,我做得很好

我上传的图像约为180kb


有什么想法吗?

这是我的服务器有问题。我切换到使用我的服务器的另一个子域,现在它工作得很好