该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
include('conn.php');
?>
$fenlei = $_POST['fenlei'];
$ebiaoti = $_POST['ebiaoti'];
$dbiaoti = $_POST['dbiaoti'];
$ejianjie = $_POST['ejianjie'];
$djianjie = $_POST['djianjie'];
$uptime=date("y-m-d");
$upfile1 = $_FILES['upfile1'][name];
$upfile2 = $_FILES['upfile2'][name];
$upfile3 = $_FILES['upfile3'][name];
$upfile4 = $_FILES['upfile4'][name];
$upfile5 = $_FILES['upfile5'][name];
$upfile6 = $_FILES['upfile6'][name];
$upfile7 = $_FILES['upfile7'][name];
$upfile8 = $_FILES['upfile8'][name];
echo $upfile1."
";
echo $upfile2."
";
echo $upfile3."
";
echo $upfile4."
";
echo $upfile5."
";
echo $upfile6."
";
echo $upfile7."
";
echo $upfile8."
";
?>
for ($i=1;"upfile".$i!="";$i++){
echo "
";
echo "运行了";
echo "upfile".$i;
$uptypes=array('image/jpg', //上传文件类型列表
'image/jpeg',
'image/png',
'image/pjpeg',
'image/gif',
'image/bmp',
'image/x-png');
上面是段多图上传的循环代码,有两个问题请教:
1,for ($i=1;"upfile".$i!="";$i++) 这个控制语句怎么无效,他会一直循环下去。
2,图片已经成功的上传到文件夹了,那么怎么把图片文件名称循环出来写入数据库呢?$fname.$i=$pinfo[basename]; 我用这个代码会出错,是不是变量是不能两个结合在一起的,那么又怎么样实现如:$fname1=1.jpg :$fname2=2.jpg $fname=3.jpg ......这样的效果呢!