通过Android应用程序在php中上载文件后重定向

通过Android应用程序在php中上载文件后重定向,php,android,redirect,Php,Android,Redirect,我试图在使用android应用程序将文件上传到服务器后向手机发送短信。当我通过浏览器在服务器端调用php脚本时,它就工作了。但是当它通过Android应用程序调用时,我没有得到任何结果,也没有错误日志。 我已经尝试使用php的header()和echo“”方法 有什么建议吗 <?php //ob_start(); $file_path = "uploads/"; $file_path = $file_path . basename( $_FILES['uploaded_f

我试图在使用android应用程序将文件上传到服务器后向手机发送短信。当我通过浏览器在服务器端调用php脚本时,它就工作了。但是当它通过Android应用程序调用时,我没有得到任何结果,也没有错误日志。 我已经尝试使用php的header()和echo“”方法

有什么建议吗

<?php
//ob_start();

   $file_path = "uploads/";

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

    if(move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $file_path)) {


        $username='abc@gmail.com';
        $password='*****';
        $sender='SMSGATEWAYHUB';
        $to='9999999999';
        $message='Test msg';
        //$head='Location:http://login.smsgatewayhub.com/API/WebSMS/Http/v1.0a/index.php?username='; 
        $head='http://login.smsgatewayhub.com/API/WebSMS/Http/v1.0a/index.php?username='; 
        $tail='&reqid=1&format={json|text}&route_id=&callback=&unique=0&sendondate=23-09-2013T07:36:02';
        $text1='&password=';
        $text2='&sender=';
        $text3='&to=';
        $text4='&message=';
        $url=$head.$username.$text1.$password.$text2.$sender.$text3.$to.$text4.$message.$tail;

        echo "<script>window.location='".$url."';</script>";
        //header($url);
        //exit;


   } else{
      echo "fail";
    }
//ob_end_flush();
?>

您是否费心检查上传是否确实发生并成功?现在,您的代码盲目地假设一切工作正常。
$\u文件['uploaded\u file']['error']
包含哪些内容?如果不是零,则上载失败。我已检查文件是否已成功上载。我是php的初学者。因此,当我从手机上传文件时,我不知道如何检查$_FILES['uploaded_file']['error']的值,它只会得到一个响应代码,指示文件上传是否成功。