
$db="editor"
$user="admin"
$pas="admin"
$conn=mysql_connect("localhost",$user,$pas) or die("连接错误")
mysql_select_db($db,$conn)
mysql_query("set names 'GB2312'")
$nba=$_FILES["bai"]["name"]
$tmpname=$_FILES["bai"]["tmp_name"]
$size=$_FILES["bai"]["size"]
$type=$_FILES["bai"]["type"]
$error=$_FILES["bai"]["error"]
if (file_exists("../upload/".$nba )){
echo "文件已存在"
}else {
foreach ($error as $key=>$val){
if($val==0){
move_uploaded_file($tmpname[$key],"../upload/" .rand().$nba[$key])
$imgpath="../upload/" .rand().$nba[$key]
echo $imgpath
$sql1 = "INSERT INTO news (title, content,imgpath) VALUES ('a','b','$imgpath')"
echo $nba[$key]."--------".$tmpname[$key]."----------".$size[$key]."--------------".$type[$key]
echo "<br>"
}
else {
echo "wrong!"}
}
}
?>
<html>
<body>
<form name="bai" id="bai" method="POST" action="wjsc1.php" enctype="multipart/form-data" >
上传文件<input type="file" name="bai[]" id="bai" />
<br>
<input type="file" name="bai[]" id="bai" />
<br>
<input type="file" name="bai[]" id="bai" />
<br>
<span style="magrin:0pxpadding:0px"><input type="image" name="img"/ src="images/submit.gif"></span>
</form>
</body>
</html>
自己对比哇,管家要把数组处理好
m文件直接放在附件1文件夹里直接运行imname = dir('.\*.bmp')%读入文件夹下的全部图像
im_num = length(imname)% 文件夹中图像的个数
im_temp = imread(imname(1).name,'bmp')%读入第一幅图像
[height,width] = size(im_temp)%得到图像的尺寸
DB(:,:,a) = zeros(height,width,im_num,'uint8')
% 读入全部图像
for a = 1:length(imname)
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)