Jump to content


Popular Content

Showing content with the highest reputation on 11/10/2018 in all areas

  1. 1 point
    As 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'];
  2. 1 point
    "your project requires" that you store files in a db? Who is making this a requirement? Not a teacher I hope!
  3. 1 point
    a) 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.
  4. 1 point
    It 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
  • Newsletter

    Want to keep up to date with all our latest news and information?

    Sign Up

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.