我试图在表obook中插入blob我已经为此目的编码了这个文件当这个页面被执行时所有工作正常表中的所有数据更新obook除了blob包含列IMAGE我得到[blob-0byte] 。有没有语法问题或我使用的方法是错误的?
<?php
session_start();
$id=$_SESSION['eid'];
include("config.php");
if(isset($_REQUEST['send']))
{
$bn=$_REQUEST['bookname'];
$pr=$_REQUEST['author'];
$au=$_REQUEST['publisher'];
$k=$_REQUEST['price'];
$image = addslashes(file_get_contents($_FILES['photo']['tmp_name']));
if(mysql_query("INSERT INTO obook(BOOKNAME,AUTHOR,PUBLISHER,PRICE,SELLER,IMAGE) VALUES('$bn','$pr','$au','$k','$id','$image')"))
{
header("location:outofstock.html");
}
else
{
header("location:index.php");
}
}
?>
<head>
<title>POSTADD</title>
<style>
@import url(http://fonts.googleapis.com/css?family=Raleway);
#main{
width:960px;
margin:50px auto;
font-family: 'Raleway', sans-serif;
}
h2{
background-color: #FEFFED;
text-align:center;
border-radius: 10px 10px 0 0;
margin: -10px -40px;
padding: 15px;
}
hr{
border:0;
border-bottom:1px solid #ccc;
margin: 10px -40px;
margin-bottom: 30px;
}
#login{
width:300px;
float: left;
border-radius: 10px;
font-family:raleway;
border: 2px solid #ccc;
padding: 10px 40px 25px;
margin-top: 70px;
}
input[type=text],input[type=email]{
width:99.5%;
padding: 10px;
margin-top: 8px;
border: 1px solid #ccc;
padding-left: 5px;
font-size: 16px;
font-family:raleway;
}
input[type=submit]{
width: 100%;
background-color:#FFBC00;
color: white;
border: 2px solid #FFCB00;
padding: 10px;
font-size:20px;
cursor:pointer;
border-radius: 5px;
margin-bottom: -12px;
}
#formget{
float:right;
}
h1 {
margin-left: -85px;
}
</style>
<style>
table{
border-spacing:15px;
}
td{
padding:30px;
}
body
{
background-image: url(back.jpg);
background-position:0px 0px;
background-attachment:fixed;
background-size: cover;
background-repeat: repeat;
}
</style>
<style>
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #ff3333;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover {
background-color: #ff8080;
}
</style>
<style>
.center {
margin: auto;
width: 60%;
padding: 100px;
}
</style>
</head>
</head>
<body>
<div class="center">
<ul>
<li><a class="active" href="index.php">NewBooks</a></li>
<li><a href="oldbook.php">OldBooks</a></li>
<li><a href="rentbook.php">Rent a book</a></li>
<li><a href="login.php?con=1">Feedback</a></li>
<li><a href="login.php">MyProfile</a></li>
</ul>
</div>
<link rel="stylesheet" type="text/css" href="style.css">
<div id="main">
<div id="login">
<h2>Old books</h2>
<hr/>
<form name="f1" onSubmit="return vali() method="post">
<label>Book Name :</label>
<input type="text" name="bookname" id="bookname" required="required" placeholder="Please Enter Book Name"/><br /><br />
<label>Author Name :</label>
<input type="text" name="author" id="author" required="required" placeholder="Please Enter Name of the Author"/><br/><br />
<label>Publication Name :</label>
<input type="text" name="publisher" id="publisher" required="required" placeholder="Please Enter Name of Puclications"/><br/><br />
<label>Price :</label>
<input type="text" name="price" id="price" required="required" placeholder="Please Price of the book"/><br/><br />
<label>Image :</label>
<input name="photo" type="file" id="photo" /><br/><br />
<input type="submit" value=" send " name="send"/><br />
</form>
</div>
<!-- Right side div -->
</div>
</body>