Android PDF发送到数据库

时间:2017-03-21 18:27:34

标签: php android database pdf

我想将新创建的PDF发送到我的数据库,但我不知道从哪里开始。我可以通过链接发送AsyncTask个变量,但我无法发送我的pdf。数据库可以获取刚找到的变量,但是一旦我尝试发送pdf,数据库中的所有内容都是NULL。我必须补充一点,我的pdf在数据库中保存为blob

Android应用

//File

byte[] byteArray = myFile.getBytes("UTF-8");

base64 = Base64.encodeToString(byteArray, Base64.DEFAULT);

url = new URL("http://aga14773.webspace.spengergasse.at/kundenexecute.php" +
    "?firstname=" + firstname + "&"
    + "lastname=" + lastname + "&"
    + "postalcode=" + postalcode + "&"
    + "citytext=" + citytext + "&"
    + "address=" + address + "&"
    + "e_mail=" + e_mail + "&"
    + "birthday=" + birthday + "&"
    + "test=" + base64);
//  + "pdf=" + blobData);

HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();

urlConnection.setDoOutput(true);

PHP文件

<?php

    include "db.inc.php";
    include "redirect.php";
    session_start();

    /*
    $id=$_POST['id'];
    $data=$_POST['stringdata'];

    echo $id;
    */
    $conn = mysqli_connect($db_server, $db_user, $db_password, $db_name)  or die("you did not connect bozo");

    $postleitzahl = $_GET['postalcode'];
    $firstname = $_GET['firstname'];
    $lastname = $_GET['lastname'];
    $citytext = $_GET['citytext'];
    $address = $_GET['address'];
    $e_mail = $_GET['e_mail'];
    $birthday=$_GET['birthday'];
    $test=$_GET['test'];

    echo $test;
    $statement = $conn->prepare("INSERT INTO kunden(kunden_plz, kunden_nachname, kunden_vorname, kunden_adresse, kunden_ort, kunden_email, kunden_geburtsdatum) VALUES (?,?,?,?,?,?,?)");

    $statement->bind_param("sssssss", $postleitzahl,        $firstname,$lastname,$citytext,$address,$e_mail,$birthday);
    $statement->execute();

?>

0 个答案:

没有答案