However when clicking the getdata.php link - the file does not appear on the screen.
The code is below.
Thank you for your time. TR .....................
//getdata.php
<? if($_GET['id']==1) { @myql_connect("localhost","root","mypass");
Remove @'s while debugging.
@mysql_select_db("sitename"); $query = "SELECT bin_data,description,filetype FROM binary_data WHERE id=1"; $result = @mysql_query($query); $data = @mysql_result($result,0,"bin_data"); $description = @mysql_result($result,0,"description"); $type = @mysql_result($result,0,"filetype"); Header( "Content-type: $type"); echo $data."<br>"; echo $description."<br>";
The above cannot work. You cannot mix binary data with html.
} else {
@mysql_connect("localhost","root","mypass"); @mysql_select_db("sitename"); $query = "SELECT bin_data,description,filetype FROM binary_data WHERE id=$id";
----------------------^^
register globals are off, and the variable is not validated - can contain anything
$result = @mysql_query($query); $data = @mysql_result($result,0,"bin_data"); $description = @mysql_result($result,0,"description"); $type = @mysql_result($result,0,"filetype"); Header( "Content-type: $type"); echo $data."<br>"; echo $description."<br>"; } ?>
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php