Forum Moderators: coopster
<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
date_default_timezone_set("Europe/London") ;
$server = "#*$!";
$sqldatabase = "#*$!";
$user2 = "#*$!";
$password = "#*$!";
$connection = odbc_connect("#*$!", $user2, $password);
$query = "SELECT TOP 1 * FROM LogAttach ORDER BY LogAttachID DESC";
$exec = odbc_exec($connection, $query);
$result = odbc_fetch_object($exec);
echo $result->FileName;
$fp = fopen($result->FileName, 'w');
fwrite($fp, $result->FileData);
fclose($fp);
?>
If you do not specify the 'b' flag when working with binary files, you may experience strange problems with your data, including broken image files and strange problems with \r\n characters.