0

i have this script that insert files into database blob type. I can see the file name, but i cannot open/download the file as you can see i tried the echo but seems it doesn't start to download the file

<form method="post" enctype="multipart/form-data" >
 <input type="file" name="myfile"/>
 <button name="btns"> Incarca Schita </button>
 </form>
 <?php
 $dbh = new PDO("mysql:host=localhost;dbname=highmob_comenzi", "highmob", "PW");
 if(isset($_POST['btns'])){
     $name = $_FILES['myfile']['name'];
     $type = $_FILES['myfile']['type'];
     $data = file_get_contents($_FILES['myfile']['tmp_name']);
     $stmt = $dbh->prepare("UPDATE players SET data='$myfile', name='$name', mime='$type' WHERE id='$id'");
     $stmt->bindParam(1,$name);
     $stmt->bindParam(2,$type);
     $stmt->bindParam(3,$data);
     $stmt->execute();
 }
 ?>
 <?php
 $stat = $dbh->prepare("select * from players where id='$id'");
 $stat->execute();
 while($row = $stat->fetch()){
     echo "<a href='".$row['data']."'>".$row['name']."</a>
     ";
 }
 ?>

0 Answers0