Mailinglisten-Archive |
Hallo,
ich bin hier schier am verzweifleln. Ich habe eine Tabelle in einer
Mysql-db wie folgt angelegt:
CREATE TABLE binary_data (
id INT(4) NOT NULL AUTO_INCREMENT,
description CHAR(50),
bin_data LONGBLOB,
filename CHAR(50),
filesize CHAR(50),
filetype CHAR(50),
primary key(id));
Mit folgendem skript will ich Bilder uploaden:
*<?php*
//code that will be executed if the form has been submitted:
if($submit) {
//connect the database
mysql_connect("localhost","**user**","**pwd**");
mysql_select_db("binary_data");
$data = addslashes(fread(fopen($form_data, "r"), filesize($form_data)));
$result=mysql_query("INSERT INTO
binary_data(description,bin_data,filename,filesize,filetype)
"."VALUES('$form_description','$data','$form_data_name','$form_data_size','$form_data_type')");
$id= mysql_insert_id();
print "<p>This file has the following database ID: <b>$id</b>";
mysql_close();
} else {
//show the form to submit new data:
*?>*
<form method="post" action="<?php echo $PHP_SELF; ?>"
enctype="multipart/form-data">
file description:<br />
<input type="text" name="form_description" size="40">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000">
<br />File to upload/store in db:<br />
<input type="file" name="form_data" size="40">
<input type="submit" name="submit" value="submit">
</form>
*<?php*
}
*?>*
Ich verstehe nicht, warum ich den upload als gelungen angezeigt bekomme,
letztlich aber nichts in der table landet.
Gruß, Ingo
php::bar PHP Wiki - Listenarchive