Mysql
 sql >> Database >  >> RDS >> Mysql

caricare un pdf usando volley ma ottiene un file nullo nella cartella del server

Prova questo,

In Java:

String encode = Base64.encodeToString(bytes, Base64.DEFAULT);

in php:

$file = $_POST['file']['name'];

//$fname = $_POST['fname']['tmp_name'];

$fname = $_POST['file']['tmp_name'];

$file_path = "uploads/";
$actualpath = "http://harpal-projects.16mb.com/sbbs/$file_path/$file";

$sql = "INSERT INTO files (file,fname) VALUES ('$actualpath','$fname') ";

if(mysqli_query($con,$sql))
{

    file_put_contents(base64_decode($file), $file_path);
    echo "success";
}
else{

    echo "fail";
}