这个只是用来协助白板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