Dear Sirs,
i need help!
The code from
http://www.phpbuilder.com/columns/florian19991014.php3
wont already work on my apache/php/mysql/win98 Server.
It's maybe because of the windows98? I modified the code on my own settings (user=localhost, pass="") and i use the same table as Florian did, the table works fine.
The only thing, it wont store the data in the db. It just does nothing, and reports me no error message.
I don't know exactyl the fopen syntax options, but the option 'rb' must stand there i read. So my code is as follows, i would thank you very much if you could help, would be very nice.
Here the code:
<HEAD><TITLE>Binary Data abspeichern</TITLE></HEAD>
<BODY>
<?php
global $HTTP_POST_VARS;
if ($submit) {
MYSQL_CONNECT("localhost","localhost","");
print mysql_error();
mysql_select_db("binary_data");
$data = addslashes(fread(fopen($form_data, "rb"), 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')");
print mysql_error();
$id= mysql_insert_id();
print "<p>This file has the following Database ID: <b>$id</b>";
MYSQL_CLOSE();
} else {
?>
<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 database:<br>
<input type="file" name="form_data" size="40">
<p><input type="submit" name="submit" value="submit">
</form>
<?php } ?>
</BODY>