php session_start(); include(conn.php);?> html> head> meta http-equiv=content-type content=text/html; charset=gb2312> title>上传单图片到服务器并显示 - www.cxybl.comtitle> head> body> table width=355 height=240 border=0 align=center cellpadding=0 cellspacing=0> tr> td width=106 height=100> td> td width=196> td> td width=31> td> tr> form name=form1 method=post action=index_ok.php enctype=multipart/form-data> tr> td height=30 align=center> td> td valign=middle>input name=images type=file id=images2 size=15> input type=hidden name=max_file_size value=30000> td> td> td> tr> tr> td height=55> td> td>input type=submit name=submit value=提交>td> td> td> tr> form> tr> td height=55> td> td> td> td> td> tr> table> table width=355 border=1 align=center cellpadding=0 cellspacing=0> php $query=select * from tb_image2 where id order by data desc limit 2; $result=mysql_query($query); if($result==true){ while($myrow=mysql_fetch_array($result)){ ?>tr> td width=100 align=center>php echo $myrow[data];?>td> td width=255 align=center>img src= width=200 height=150>td> tr> php }}?> table> body> html>
conn.php:
index_ok.php:
1000000) {echo ;}else{ $path = 'upfiles/'. $_files['images']['name']; if (move_uploaded_file($_files['images']['tmp_name'],$path)) { $query1=insert into tb_image2(path,data,image_name)values('$path','$data','$images'); $result1=mysql_query($query1); if($result1=true){ echo 上传成功!!; echo ; }else{echo 文件上传失败!!; echo ;} }}} ?>
