PRodgers4284 Posted February 15, 2008 Share Posted February 15, 2008 Im having problems with download a file my a database, i can upload the file to the database fine, but i cant same to get the download file working, its just displaying a blank page, can anyone help? <?php session_start(); include("database.php"); if(isset($_GET['id'])) { $id = $_GET['id']; $query = "SELECT name, type, size, content FROM upload WHERE id = '$id'"; $result = mysql_query($query) or die('Error, query failed'); list($name, $type, $size, $content) = mysql_fetch_array($result); echo $content; exit; } ?> <html> <head> <title>Download CV</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <?php include("database.php"); $query = "SELECT id, name FROM upload"; $result = mysql_query($query) or die('Error, query failed'); if(mysql_num_rows($result) == 0) { echo "Database is empty <br>"; } else { while(list($id, $name) = mysql_fetch_array($result)) { ?> <a href="download.php?id=<?php=$id;?>"><?php=$name;?></a> <br> <?php } } ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/91222-file-download-problem/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.