//多文件上传
//html
1 <form enctype="multipart/form-data" action="" method="post">
2 <input type="hidden" name="MAX_FILE_SIZE" value="3000000" />
3 左上角图片<input name="userfile[]" type="file"size="29"> 该图片链接:<input type="text" name="purl[]" size="48"/><br>
4 右上角图片<input name="userfile[]" type="file"size="29"> 该图片链接:<input type="text"name="purl[]" size="48"/><br>
5 左下角图片<input name="userfile[]" type="file"size="29"> 该图片链接:<input type="text"name="purl[]" size="48"/><br>
6 右上角图片<input name="userfile[]" type="file"size="29"> 该图片链接:<input type="text"name="purl[]" size="48"/><br>
7 <input type="submit" value="提 交" />
8 </form>
2 <input type="hidden" name="MAX_FILE_SIZE" value="3000000" />
3 左上角图片<input name="userfile[]" type="file"size="29"> 该图片链接:<input type="text" name="purl[]" size="48"/><br>
4 右上角图片<input name="userfile[]" type="file"size="29"> 该图片链接:<input type="text"name="purl[]" size="48"/><br>
5 左下角图片<input name="userfile[]" type="file"size="29"> 该图片链接:<input type="text"name="purl[]" size="48"/><br>
6 右上角图片<input name="userfile[]" type="file"size="29"> 该图片链接:<input type="text"name="purl[]" size="48"/><br>
7 <input type="submit" value="提 交" />
8 </form>
//php
1 <?php
2 $new_folder='attachment/yeynewpic';
3 $POSTURL = $_POST['purl'];
4 for ($i=1;$i<=count($_FILES['userfile']['tmp_name']);$i++) {
5 $upfile=$new_folder."/".$i.".jpg";
6 if(move_uploaded_file($_FILES['userfile']['tmp_name'][$i-1],$upfile))
7 echo"上传成功";
8 }
9 ?>
2 $new_folder='attachment/yeynewpic';
3 $POSTURL = $_POST['purl'];
4 for ($i=1;$i<=count($_FILES['userfile']['tmp_name']);$i++) {
5 $upfile=$new_folder."/".$i.".jpg";
6 if(move_uploaded_file($_FILES['userfile']['tmp_name'][$i-1],$upfile))
7 echo"上传成功";
8 }
9 ?>
//单文件上传
//html
1 <form enctype="multipart/form-data" method="POST" action="admincp.php?ac=tuijianpic">
2 图片:<input type="file" size="45" name="userfile">
3 <input type="hidden" name="MAX_FILE_SIZE" value="3000000" />
4 <input type="submit" value="提 交">
5 </form>
6
7
2 图片:<input type="file" size="45" name="userfile">
3 <input type="hidden" name="MAX_FILE_SIZE" value="3000000" />
4 <input type="submit" value="提 交">
5 </form>
6
7
//php
1 $uploaddir = 'attachment/tuijianpic/';
2 $pic_addr = basename($_FILES['userfile']['name']);
3 $uploadfile=$uploaddir.date("ymd")."_".$pic_addr; //加上日期避免名重复
4 if($_POST['MAX_FILE_SIZE']==3000000)
5 move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile);
2 $pic_addr = basename($_FILES['userfile']['name']);
3 $uploadfile=$uploaddir.date("ymd")."_".$pic_addr; //加上日期避免名重复
4 if($_POST['MAX_FILE_SIZE']==3000000)
5 move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile);