1 pointAs you are too lazy to specify column names in your SELECT and INSERT statements, some of this is guesswork. But it should look something like this $stmt = $db->prepare("SELECT name , size , mime , data FROM files WHERE id = ? "); $stmt->execute([ $_GET['id'] ]); $file = $stmt->fetch(); header('Content-Disposition: attachment; filename="'.basename($file['name']).'"'); header('Content-Type: '.$file['mime']); header ('Content-Length: '.$file['size']); echo $file['data'];
1 point"your project requires" that you store files in a db? Who is making this a requirement? Not a teacher I hope!
1 pointa) it is generally not a good idea to store files in a database (getting large data into and out of the database is a problem. and sql dumps are twice the size since they are done in hexadecimal.) databases are for storing data. file systems are for storing files. b) if you do store files in a database, you must store all of the file. the blob type you have used only holds 64K bytes. the file size your code allows is 5M bytes (and would take special handling to store since the default data packet size is 1M bytes.) the actual size of your test file is 102k bytes, which was then cut off at 64K when it was stored. c) the php code in download.php is trying to check the existence of and read the file as though it is stored in the file system, not in the database.
1 pointIt also doesn't say so on the documentation for explode() or mysqli_connect(). That function is part of the GeoIP package, which has a whole section dedicated to setting it up.
This leaderboard is set to New York/GMT-04:00