Re: binary data in php
| From: | Anthony Ritter | Date: | Fri, 16 Apr 2004 13:18:24 +0000 |
| Subject: | Re: binary data in php | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-183620@lists.php.net to get a copy of this message | ||
Marek Kilimajer <kilimajer@webglobe.sk> wrote in message:
> You said register globals are off, didn't you? Where is the above
> variable set then?
>
> :)
...................
That was it.
Many thanks Marek and others.
Checking through the command line the file was uploaded to mysql database.
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");
@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>";
}
else
{
@mysql_connect("localhost","root","mypass");
@mysql_select_db("sitename");
$query = "SELECT bin_data,description,filetype
FROM binary_data
WHERE id=$id";
$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>";
}
?>