Hello,
I'm trying to upload a movie clip into a Mysql table, but I understand it's better if I reference it as storing large file over 1M in a database is not effective.
I've witting a PHP script and an HTML form to help me in achieving this, but each time I fill and submit the html form and PHP processes it the nothing happens in Mysql and PHP returns no error message and even no messahe whatsoever, I've edited the PHP.INI file and increased my upload_max_filesize to 80M, the post_max_size to 85M, the memory_size to 90M and my temp_dir to D:\php\temp, and file uploads is on, I've an upload funtion for simple datatype (i.e char, int and varchar) and they all work well, but blobtype tables just wont upload. I've gone through the script and html form a lot of times but no luck i'm hoping someone here might see what I'm doing wrong. My script and html codes are below. Thank you.
<?php
$session = mysql_connect("localhost", "root", "platinum");
mysql_select_db("xplosive");
$fd = fopen($form_data, "r")or die(mysql_error());
$data = addslashes (fread($fd, filesize($form_data)));
$query = "INSERT INTO trailer(Clip, filename, filesize, filetype)".
"VALUES ('$data', '$form_data_name', '$form_data_size', '$form_data_type')";
$result = mysql_query($query);
if (!$result )
{
echo "<p>Error performing INSERT:" .mysql_error(). "</p>";
}
else
{
$Id = mysql_insert_id();
print "<p> Upload succesful. Trailer ID: <B>$Id</B>";
}
fclose($fd);
mysql_close($session);
?>
and here's my html code:
<html>
<head>
<title>Add Trailer</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"></head>
<body background="../Graphics/backgd.gif">
<div align="center">
<p align="center"<img src="D:\phpWeb\Graphics\Xlogo.png" width="252" height="152"></p>
<h1>Upload trailer to the database</h1>
</div>
<form method="post" action="trailer.php" enctype="multipart/form-data">
<p style="font-size: 15pt; color:black;font-syle: sylfaen">Trailer:<BR>
<input type="file" name="form_data" size="40">
<input type="hidden" name="max_file_size" value="1073741824">
<BR>
<BR>
<input type="submit" name="submit" value="Upload"</form>