PHP上传文件与数据库6 php上传文件导入数据库( 二 )


$thread = mysql_fetch_assoc($query);
if($thread){
header('content-type:'.$thread['type']);
echo $thread['binarydata'];
exit();
}
}else{
// 显示图片列表及上传表单
?
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" ""
html
head
meta http-equiv="content-type" content="text/html; charset=utf-8"
title upload image to db demo /title
/head
body
form name="form1" method="post" action="upload_image_todb.php" enctype="multipart/form-data"
p图片:input type="file" name="photo"/p
pinput type="hidden" name="action" value="https://www.04ip.com/post/add"input type="submit" name="b1" value="https://www.04ip.com/post/提交"/p
/form
?php
$sqlstr = "select * from photo order by id desc";
$query = mysql_query($sqlstr) or die(mysql_error());
$result = array();
while($thread=mysql_fetch_assoc($query)){
$result[] = $thread;
}
foreach($result as $val){
echo 'pimg
src="https://www.04ip.com/post/upload_image_todb.php?action=showid='.$val['id'].'t='.time().'"
width="150"/p';
}
?
/body
/html
?php
}
?
程序运行截图和数据库截图:
【PHP上传文件与数据库6 php上传文件导入数据库】PHP上传文件与数据库6的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于php上传文件导入数据库、PHP上传文件与数据库6的信息别忘了在本站进行查找喔 。