phpbar.de logo

Mailinglisten-Archive

Mal wieder images in DB
Archiv Mailingliste mysql-de

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Mal wieder images in DB



Hallo Liste,

verzweifelt versuche ich images in eine MySQL DB zu bekommen. Ich habe
diverse scripte die ein solches Feature enthalten durchsucht und auseinander
genommen aber ich komme nicht weiter.
Folgendes habe ich bisher gemacht:

CREATE TABLE bin (
  id int(11) DEFAULT '0' NOT NULL auto_increment,
  title varchar(200) NOT NULL,
  auth_id varchar(16) NOT NULL,
  description varchar(200),
  category varchar(50) NOT NULL,
  body longblob,
  cr_date date,
  datestamp timestamp(14),
  type varchar(50) NOT NULL,
  KEY category (category),
  KEY title (title),
  KEY auth_id (auth_id),
  PRIMARY KEY (id)
);

Und nun das loading script:

<? file://load.php3
 require("header.inc");
 if (isset($submit))
    {
$date = date("Y-m-d");


chop($fileinput)!=""){ 

                // $fileinput should point to a temp file on the server 
                // which contains the uploaded image. so we will prepare 
                // the file for upload with addslashes and form an sql 
                // statement to do the load into the database. 

                $image = addslashes(fread(fopen($fileinput,"r"), 1000000)); 
                $SQL = "Insert Into tabelle (title,auth_id,description,category,body,cr_date,type) values ('$title',  
'$auth_id', '$desc', '$cat', '$image','$date','$type')"; 

                // now we can delete the temp file 
                unlink($fileinput); 
        } 
        else{ 
                echo "no file entered on form"; 
                exit; 
        } 

        $Result = mysql_db_query ("tabelle", $SQL ); 

        if($Result==0){ 
                echo "unsuccessful add"; 
        } 
        else{ 
                echo "successful add"; 
        } 
}
?> 

  <table border="1" bgcolor="#9999FF" cellpadding="5" width="350">
    <tr>
      <td> 
        <form method="post" action="load.php3">
          <table border="0" width="100%">
            <tr> 
              <td align="right">Name:</td>
              <
td bgcolor="#CCCCFF">
                <input type="text" name="title" style="width:200px;">
              </td>
            </tr>
            <tr>
              <td align="right">auth id:</td>
              <td bgcolor="#CCCCFF">
                <input type="text" name="auth_id" style="width:200px;">
              </td>
            </tr>
            <tr>
              <td align="right">beschreibung:</td>
              <td bgcolor="#CCCCFF">
                <input type="text" name="desc" style="width:200px;">
              </td>
            </tr>
            <tr>
              <td align="right">kategorie:</td>
              <td bgcolor="#CCCCFF">
                <input type="text" name="cat" style="width:200px;">
              </td>
            </tr>
            <tr>
              <td align="right">bild:</td>
              <td bgcolor="#CCCCFF">
                <input type="file" name="body" style="width:200px;">
              </td>
            </tr>
            <tr>
              <td align="right">Type:</td>
              <td bgcolor="#CCCCFF">
                <input type="text" name="type" style="width:200px;">
              </td>
            </tr>
            <tr>
              <td align="right">&nbsp;</td>
              <td bgcolor="#CCCCFF">
                <input type="submit" name="submit" value="Eintragen!">
              </td>
            </tr>
          </table>
        </form>
      </td>
    </tr>
  </table>

 <?
   }
 require("footer.inc");
?>

Die header.inc
<?
 mysql_pconnect ("localhost", "root", "") or mysql_die();
?>
<html>
<body>

Die footer.inc

</body>
</html>

Meldung nach Erfassung: no file entered on form, dabei waehle ich doch ein
entsprechendes aus.
Uebersehe ich irgendetwas ? Hat jemand eine Idee. Danke im voraus fuer die
Muehe.

Olaf

---
*** Abmelden von dieser Mailingliste funktioniert per E-Mail
*** an mysql-de-request_(at)_lists.4t2.com mit Betreff/Subject: unsubscribe


Home | Main Index | Thread Index

php::bar PHP Wiki   -   Listenarchive