Re: copy image from database

From: Date: Sat, 08 Dec 2001 12:28:10 +0000
Subject: Re: copy image from database
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-77126@lists.php.net to get a copy of this message
read the specs on copy() it copys a source file to a destination file... You are not copying files!... You should use something like fwrite to write the contents of $image to a file... Andrew ----- Original Message ----- From: "Jan Grafström" <jan@grafstrom.net> To: <php-general@lists.php.net> Sent: Saturday, December 08, 2001 8:28 AM Subject: [PHP] copy image from database > Hi! > I have images in my DB and want to write them to disk. I tried to copy but > nothing happend, > the image only pops up in my browser with "echo". I want it saved in a > directory on my server. > ----- > $query = "select bin_data,filetype from $table where id=$id"; > $result = @MYSQL_QUERY($query); > $image = @MYSQL_RESULT($result,0,"bin_data"); > echo $image; > $destfile="image.jpg"; > copy($image,$destfile) > ----- > Thanks for any help > Regards, > Jan > -- > Jan Grafström > Lillemans Hus AB > Sweden > 46 (0)611-60920 > 46 (0)70-6409073 > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#77126) next »