Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

pics?

Codes here !

Moderators: macek, egami, gesf

pics?

Postby infomorelos » Tue Feb 04, 2003 1:52 am

Hi,
can I put images into a MySQL table?
If so, which kind of field would that be?

Thank you in advance
infomorelos
New php-forum User
New php-forum User
 
Posts: 14
Joined: Mon Jan 27, 2003 12:10 am
Location: Cuernavaca, Mexico

Postby Oleg Butuzov » Tue Feb 04, 2003 2:38 am

1) Yes you can
2) BLOB
Oleg Butuzov
Last Samuray
Last Samuray
 
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Postby Elena Mitovska » Tue Feb 04, 2003 11:18 pm

One of the ways to insert image:
$data = "";
$userfile = $HTTP_POST_FILES['userfile']['tmp_name'];
//get file
$fp = fopen($userfile, "rb");
while(!feof($fp))
{
$data .= fread($fp, 1024);
}
fclose($fp);

$data = addslashes($data);
$data = addcslashes($data, "\0");

//insert image into database
$Query = "INSERT INTO imagesVALUES(".$item_no.",'$data')";
Elena Mitovska
New php-forum User
New php-forum User
 
Posts: 13
Joined: Tue Nov 12, 2002 12:11 pm
Location: Ukraine

Postby Oleg Butuzov » Tue Feb 04, 2003 11:28 pm

Helen, you forgot to say "thank you http://php.spb.ru"

he is author of the script =)
Oleg Butuzov
Last Samuray
Last Samuray
 
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am


Return to mySQL & php coding

Who is online

Users browsing this forum: Google [Bot] and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron