Filetransfer to server,然后使用参数填写表单?

时间:2014-04-28 01:41:37

标签: javascript android cordova

我已成功将我的文件传输到我的服务器,但我也在发送参数,如何在执行此操作后重定向到页面并预先填充这些参数?人们说它只是$ _POST,但我无法得到它。

function uploadPhoto(imageURI) {
            var title1 = document.getElementById('title').value;
            var desc1 = document.getElementById('desc').value;

            var options = new FileUploadOptions();
            options.key = "file";
            options.fileName = imageURI.substr(imageURI.lastIndexOf('/')+1);
            options.mimeType = "image/jpeg";

            var params = {};
            params.title = title1;
            params.desc = desc1;

            options.params = params;
            options.chunkedMode = false;

            var ft = new FileTransfer();
            ft.upload(imageURI, "HTTP:HERP", win, fail, options);
            window.location.href = "HTTP:DERP";
        }

服务器代码

<?php 
if(isset($_POST["title"]))
    var_dump($_POST["title"]); 
?>

1 个答案:

答案 0 :(得分:0)

尝试:

echo $_REQUEST['title'];
echo $_REQUEST['desc'];
print var_dump($_REQUEST);