Hi,
I've made a large sum of posts recently and if I can figure out this problem with your help then you can say goodbye to my relentless pestering. I've made an upload script that lets user upload files to my db. The fields used in the table in the db are: id,name,size,type,file and respectively correspond to int,varchar,int,varchar,mediumBLOB. I will post the download code below so you guys can take a look at it and tell me what you think the solution is. The problem is that when I print out the data on the screen using echo all i get for the file is some directory which doesn't allow for downloading.
PHP Code:
<?php
$Server="xxxx";
$User="xxxx";
$Password="xxxx";
$Database="xxxx";
$con = mysql_connect($Server,$User,$Password);
if(!$con){
die("Couldn't Connect " . mysql_error());
}
mysql_select_db($Database,$con);
$sql = "SELECT * FROM IB2FILES";
$ctq = mysql_query($sql,$con);
if (!$ctq)
{
die("SQL Error! Query is $query<br />Error is ".mysql_error());
}
while ($row = mysql_fetch_assoc($ctq)) {
echo "<table> <tr> <td>";
echo "ID: ";
echo $row['id'];
echo "</td> </tr> <tr> <td>";
echo "Name: ";
echo $row['name'];
echo "</td> </tr> <tr> <td>";
echo "Type: ";
echo $row['type'];
echo "</td> </tr> <tr> <td>";
echo "Size: ";
echo $row['size'];
echo " bytes";
echo "</td> </tr> <tr> <td>";
echo "tmp_file: ";
echo $row['file'];
echo "</td> </tr> <tr> <td>";
echo "</table>";
}
?>
This is an example of what I get:
ID: 4
Name: About Stacks.pdf
Type: application/pdf
Size: 466028 bytes
tmp_file: /usr/local/pem/vhosts/113282/tmp/phpltvObD
Thanks, Eric