Bildupload in eine Datenbank
Hallo, wer kann mir helfen, ich habe da ein file, das ein bild in eine datenbank uploaden soll:
Das tut er aber nicht, ich schätze, weil das ein php3 file war, wer kann mir helfen, das in php4 umzuschreiben ? Was könnte da falsch sein ?
<?php
// file zum
// upload
// von Bildern in eine datenbank
?>
<HTML>
<HEAD><TITLE>Bildupload</TITLE></HEAD>
<BODY>
<?php
// code that will be executed if the form has been submitted:
if ($submit) {
// connect to the database
// (you may have to adjust the hostname,username or password)
MYSQL_CONNECT("xxxx.xxx.at","xxxx","xxxxx");
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','$for m_data_type')");
$id= mysql_insert_id();
print "<p>This file has the following Database ID: <b>$id</b>";
MYSQL_CLOSE();
} else {
// else show the form to submit new data:
?>
<form method="post" action="<?php echo $PHP_SELF; ?>" enctype="multipart/form-data">
File Beschreibung:<br>
<input type="text" name="form_description" size="40">
<INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1000000">
<br>File to upload/store in database:<br>
<input type="file" name="form_data" size="40">
<p><input type="submit" name="submit" value="submit">
</form>
<?php
}
?>
</BODY>
</HTML>
danke für eure hilfe
|