Don't know if this will help but here is some code I have just found by accident
//////////////////////////
// -- database dummy -- //
//////////////////////////
/// begin cut! ////////////////////////////////////
CREATE TABLE gambar (
idnum int(11) DEFAULT '0' NOT NULL auto_increment,
gambar blob NOT NULL,
PRIMARY KEY (idnum),
KEY artnr (idnum),
UNIQUE artnr_2 (idnum)
);
/// end cut! ///////////////////////////////////////
///////////////////////////////////////
// -- upload file ( upload.php3 ) -- //
///////////////////////////////////////
/// begin cut! ///////////////////////////////////////////
try it upload your image here !<br>
<FORM ENCTYPE="multipart/form-data" ACTION=" <?echo$PHP_SELF?>" METHOD=POST>
Send this file: <br>
<INPUT NAME="userfile" TYPE="file">
<br><INPUT TYPE="submit" name="upload" VALUE="Send File">
</FORM>
<br>note only allow < 3000 bytes, please dont abuse my server!<br>
thanks, and happy phping and myslqing!! hehe<br><br>
idban secandri<br>
<br>click here to see your image <a href="tampil.php3?id=any_number">tampil.php3?id=any_number</a>
<br>or here <a href="tampil.php3">tampil.php3</a> too see index of images<br>
<?
//leave this credit GPL version by idban secandri 2000
// checking for sumbit button, pressed? if yess execute this
if ($upload) {
//checking for file size, you wont user upload over 1Mb right?
$max=filesize($userfile);
if ($max > "3000")
{ echo "<b><br><br><font color=\"red\">ops file too big!\n<br> your $userfile_name size = $userfile_size upload max = 3000 bytes</font></b>"; die; }
//checking for file type, you wont user upload any .php right?
if (($userfile_type == "image/gif" ) or ($userfile_type == "image/jpeg") or ($userfile_type == "image/jpg")) {
//read uploaded file on temp, and put it on variable
$imagedata = addslashes(fread(fopen($userfile, "r"), filesize($userfile)));
$hostname = "127.0.0.1"; // host
$username = "change_this"; // user
$password = "change_this"; // password
$usertable = "gambar"; // tablename
$dbName = "change_this"; // dbname
//connect to database
MYSQL_CONNECT($hostname, $username, $password) OR DIE( "Unable to connect to database");
@mysql_select_db( "$dbName") or die( "Unable to select database");
//insert variable into database
$insert = "insert into $usertable values('$idnum','$imagedata')";
$result = MYSQL_QUERY($insert);
$query = "SELECT * FROM $usertable WHERE(idnum=$idnum)";
$insert = MYSQL_QUERY($query);
$idnum = mysql_insert_id();
$i++;
echo "<img src=\"tampil.php3?id=$idnum\"><br>";
echo "<b><br>click here to see your image <a href=\"tampil.php3?id=$idnum\">tampil.php3?id=$idnum</a>\n<br>or here <a href=\"tampil.php3\">tampil.php3</a> too see index of images";
MYSQL_CLOSE();
die;
}
echo "<b><br><br><font color=\"red\">$userfile_name isnt a file type!</font></b>";
}
?>
/// end cut! ////////////////////////////////////////////////////////////
/////////////////////////////////////
// -- view file ( tampil.php3 ) -- //
/////////////////////////////////////
/// begin cut! ////////////////////////////////////////////////////////////
<?
//leave this credit GPL version by idban secandri 2000
$hostname = "127.0.0.1"; // host
$username = "change_this"; // user
$password = "change_this"; // password
$usertable = "gambar"; // tablename
$dbName = "change_this"; // dbname
//connect to database
MYSQL_CONNECT($hostname, $username, $password) OR DIE( "Unable to connect to database");
@mysql_select_db( "$dbName") or die( "Unable to select database");
//count totalrecords
$totaldata = mysql_query( "SELECT Count(*) as total FROM $usertable") or die(mysql_error());
$rowtotal=mysql_fetch_Array($totaldata);
$totaldata=$rowtotal[total];
//checking variable input $id
if (($id == "") or ( $id > $totaldata )) {
echo "<font face=\"verdana\" size=-2>use like <img src=\"http://$HTTP_HOST$PHP_SELF?id=number\"><br>\n";
echo "or just like this if on your own server <img src=\"$PHP_SELF?id=number\"><br>\n";
//query database
$img_query = mysql_query( "select from $usertable") or die(mysql_error());
while ($row = mysql_fetch_array($img_query))
{
$idnum=$row[ "idnum"];
echo "or try this <a href=\"$PHP_SELF?id=$idnum\">http://$HTTP_HOST$PHP_SELF?id=$idnum</a><br>\n";
}
echo "</font>";
MYSQL_CLOSE();
die;
}
else {
$news_query = mysql_query( "select from $usertable where idnum=\"$id\"") or die(mysql_error());
while ($row = mysql_fetch_array($news_query))
{
$idnum=$row[ "idnum"];
$gambar=$row[ "gambar"];
}
//add type a img file, change to other binary if you want 🙂
Header( "Content-type: image/gif");
echo "$gambar";
MYSQL_CLOSE();
}
?>
/// begin cut! ////////////////////////////////////////////////////////////
And yes please I would like the ASP version, which DB does it use?
neil.williams@olealliance-dg.co.uk