Hello
I'm just created a php script for updating a mysql table and each time try to upload insert into the table I always get my specified error message, I don't know what the problem isI've checked the script over and ocer again, but can't find any error, there is a mediumblob file (26.4M😎 in the data I want to insert, but php is just not opening the data in the html uploa form.Please help 🙁
Here is the script and html form:
The PHP script:
<?php
$session = mysql_connect("localhost", "root", "platinum");
mysql_select_db("xplosive");
$fd = fopen($form_data, "r") or die("Cannot read the data in the submitted form $form_data");
$data = addslashes(fread($fd, filesize($form_data)));
$query = "INSERT INTO movies(title, genre, trailer, synopsis, tfilename, tfilesize, tfiletype, picture, pdescription, pfilename, pfilesize, pfiletype, price) ".
"VALUES ('$title', '$genre', '$data', '$synopsis', '$form_data_name', '$form_data_size', '$form_data_type', '$data', '$pdescription', '$pform_data_name', '$pform_data_size', '$pform_data_type', '$price')";
$result = mysql_query($query);
if (!$result )
{
echo ( "<p> ERROR: DATA NOT INSERTED: " .mysql_error() . "</p>" );
}
else
{
$Itemcode = mysql_insert_id();
print "<p>This product has the following code:<B>$Itemcode</B>";
}
fclose($fd);
mysql_close($session);
?>
and here's the html form:
<HTML>
<HEAD>
<TITLE>STORE MOVIE</TITLE>
</HEAD>
<BODY>
<FORM method="post" action="store.php" enctype="multipart/form-data">
<p>Title: <BR>
<input type="text" name="title" size="70"> </p>
<p>Genre: <BR>
<input type="text" name="genre" size="25"> </p>
<p>Synopsis: <BR>
<textarea name = "synopsis" rows = "6" cols = "n" size="250">
</textarea>
</p>
<p>Trailer to store in database: <BR>
<input type="file" name="form_data" size="45">
<input type="hidden" name="max_file_size" value="1073741824">
</p>
<p>Picure: <BR>
<input type="file" name="pdescription" size="45">
<input type="hidden" name="max_file_size" value="1073741824">
</p>
<p>Price: <BR>
<input type="text" name="price" size="20">
</p>
<input type="submit" name="submit" value="Submit"
</FORM>
</BODY></HTML>