bolb是mysql里面的一个字段类型,用来存储二进制数据。
form表单上传:
<form enctype="multipart/form-data">
<input type="file" name="file">
</form>
上传处理:
$PhotoType = $_FILES['file']['type'];
$Photo=$_FILES['file']['tmp_name'];
$data = addslashes(fread(fopen($Photo, "r"), filesize($Photo)));
$conn=new mysqli("127.0.0.1","root","","tbl");
mysqli_set_charset($conn,"utf8");
$sql="insert into tbl_student (StuNo,Pwd,Name,Sex,Birthday,Major,Detail,Photo,PhotoType) values ('$StuNo','$Pwd','$Name','$Sex','$Birthday','$Major','$Detail','$data','$PhotoType')";
echo "<br/>";
$result=$conn->quer