一种简易的图片上传,并在另一个页面批量适应窗口宽度进行显示的PHP脚本

这个只是用来协助白板APP进行图片上传下载用的PHP脚本,非常简陋,仅供大家参加


图片接收端:

<?php  
include "conn.php";
$target_path  = "./photo_icon/";//接收文件目录  
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);  
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) 
{  
   //echo "The file ".  basename( $_FILES['uploadedfile']['name']). " has been uploaded";  
   //$sql="INSERT INTO picInfo (picName, picPath) VALUES ('$name', 'photo_icon/$name'); ";
   //$result=mysql_query($sql);
   //if($result=='1'){
       //echo "保存数据库成功";
   //}else{
       //echo "保存数据库失败";
   //}
}  else
{  
   echo "There was an error uploading the file, please try again!" . $_FILES['uploadedfile']['error'];  
}  
mysql_close($link)
?>  

批量获得图片端,每张图片用逗号分割:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>图片文档</title>
<?php
	$picsJson = $_GET['picsJson'];
	$array = explode(",", $picsJson);
	foreach ($array as $val)
	{
		?>
        <img src="photo_icon/<?php echo $val?>" width="100%" />
	    <?php 
	}
?>
</head>
<body>

</body>
</html>



效果测试:

http://www.dazzle-wisdom.com:20000/uploadPic/show_photos.php?picsJson=20180611194932607.png,20180611194932190.png,20180611194932653.png




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值