Hello
I'm trying to reference a movie trailer in MySQL using PHP, i don't want to upload the movie directly into Mysql as it is big so I'm keeping it in an external file. Anyway I've written my PHP script and an HTML to accompany it
but each time I submit the form and it got passed on to the script for processing the script screen, gives me no feedback, no error message or upload succesful message just a blank screen, and I tried to see if the file was succesfully referenced in MySQL but the table was blank meaning it wasn't succesful, can anyone please help.
Here is the PHP script
<?php
$session = mysql_connect("localhost", "root", "platinum");
mysql_select_db("xplosive");
$fd = fopen($form_data, "rb")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 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>