Thanks for the help, I found the problem. Turns out nothing was in the blobs, it just wasn't uploading. Fixed now though. Thanks again!
Thanks, Stephen Craton http://www.melchior.us -- http://www.melchior.us/portfolio -----Original Message----- From: John Hicks [mailto:[EMAIL PROTECTED] Sent: Monday, November 10, 2003 8:31 PM To: Stephen Craton Subject: Re: [PHP] Downloading MySQL Files On Monday 10 November 2003 08:07 pm, Stephen Craton wrote: > I have a database which keeps some normal files in > LONGBLOBS. I then call up a file called download.php > to retrieve the file from the database, echo out > it’s contents, and it’s type, and all that so they > download it. > However, if the user clicks the > download link, they download the actual download.php > file and if they open it, it’s blank. Here is where you begin to get confused. The output of your php page will be called download.php, no matter what is in it. Obviously they are not downloading the contents of your download.php file since that file is obviously not blank. Rather they are downloading the output generated by your download.php, which is nothing. > I’ve attached > the code to download.php. Any ideas why this is > happening and how to fix it? Are you getting any PHP errors? (Check your log.) Are you getting any MySQL errors? (You should include an error check in your statements.) If no to the above, then break the program down into parts and output debug statements. E.g. echo that the if conditional is being executed, echo the contents of the first SQL statement, echo the variables of the output, etc. Hope this helps. --John > <?php > > if (isset($HTTP_GET_VARS['id'])) { > > > include('Connections/default.php'); > > > mysql_select_db($database_default, $default); > > $id = > $HTTP_GET_VARS['id']; > > > > $query = "SELECT * > FROM files WHERE id='$id'"; > > $result = > mysql_query($query, $default); > > $row = > mysql_fetch_array($result); > > $new = > $row['downloads'] + 1; > > $query = "UPDATE > files SET downloads='$new' WHERE id='$id'"; > > $result = > mysql_query($query, $default); > > > > $type = > $row["ftype"]; > > $name = > $row["fname"]; > > $size = > $row["fsize"]; > > $id = $row["id"]; > > $data = > urldecode($row["fdata"]); > > > > > header("Content-type: $type"); > > > header("Content-length: $size"); > > > header("Content-Disposition: attachment; > filename=$name"); > > > header("Content-Description: PHP Generated Data"); > > > > echo $data; > > exit(); > > } > > ?> > > > > > > Thanks, > > Stephen Craton > > HYPERLINK > "http://www.melchior.us"http://www.melchior.us -- > HYPERLINK > "http://www.melchior.us/portfolio"http://www.melchio >r.us/portfolio > > > > > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system > (http://www.grisoft.com). Version: 6.0.532 / Virus > Database: 326 - Release Date: 10/27/2003 --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.532 / Virus Database: 326 - Release Date: 10/27/2003 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.532 / Virus Database: 326 - Release Date: 10/27/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php