Dear Aziz I sufferd a lot do that to. I send a code that work for me. But I
think that have a better way to do that.

Regards,

Waldemar

Grupo3.php show the picture and can send another to update a blob field in
Grupo4.php.

----- Original Message -----
From: "Aziz Durmaz" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, May 10, 2002 7:51 AM
Subject: RE: [PHP-WIN] XML parsing


> Hi,
>
> I have a problem with inserting image into the mysql database (Blob field)
> with php codes...
>
> How can i insert a image into the mysql DB with php codes...
> I find some codes but they are not work....
>
> Sample code to upload .......
> <?php
> if (isset ($actionflag) && $actionflag=="upload"){
> $fd = fopen ($filename, "r");
> $contents = fread ($fd, filesize ($filename));
> fclose ($fd);
> $contents = addslashes($contents);
>     $conex = mysql_connect ("localhost", "root", "metaz");
> mysql_select_db("usarice", $conex);
> $sSql = "insert into upload (resim) values ('" . $contents . "')";
> $result = mysql_query($sSql, $conex);}
> ?>
> <html>
> <body>
> <title>Upload</title>
> <form action="<?php print $php_SELF; ?>" enctype="multipart/form-data">
> <input type="file" name="filename">
> <input type="hidden" name="actionflag" value="upload">
>   <br>
>   <input type="submit">
> </form>
> </body>
> </html>
>
> Sample code to show
> <?
> header ("Content-type: image/gif");
> $conex = mysql_connect ("localhost", "root", "metaz");
> mysql_select_db("usarice", $conex);
> $sSql = "SELECT resim FROM upload";
> $result = mysql_query($sSql, $conex);
> $row = mysql_fetch_array($resultado, MYSQL_ASSOC);
> ob_start();
> echo $row[resim];
> ob_end_flush();
>
>
> ?>
>
> thanks...
> Aziz Durmaz
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to