在页面中直接上传即可,下面为代码://界面
<form atcion=getfile.php enctype="multipart/form-data" method=post >
选择文件 <input type=file name=my_file>
<br>
<input type=submit value=ok>
</form>
// 接受文件处理 --getfile.php 这了有几个变量,$my_file 即为上传的文件
// $my_file_name 是上传文件名 $my_file_size 是文件大小 $my_file_type 为文件类型
// 这几个变量就可以实现对文件的操作
<?
$path="./"; copy($my_file,$path); //将文件拷贝到服务器当前目录下
?>
<form atcion=getfile.php enctype="multipart/form-data" method=post >
选择文件 <input type=file name=my_file>
<br>
<input type=submit value=ok>
</form>
// 接受文件处理 --getfile.php 这了有几个变量,$my_file 即为上传的文件
// $my_file_name 是上传文件名 $my_file_size 是文件大小 $my_file_type 为文件类型
// 这几个变量就可以实现对文件的操作
<?
$path="./"; copy($my_file,$path); //将文件拷贝到服务器当前目录下
?>
session_save_path("tmp/");
session_start();
if(!session_is_registered(userid)) {
echo "你没有正确的登陆本系统,请登陆!";
echo "<br>现在进入登陆系统,请稍侯.....";
echo "<meta http-equiv=\"refresh\" content=\"1; url=index.php\">";
exit();
}
include "lib/head.inc";
if($submit)
{
require "config.php";
$folder_name=date("Ymd");
if(!file_exists($images_dir.$folder_name)) {
mkdir("$images_dir$folder_name",0700);
}
//上传文件的目录为程序主体的images下
$filedir="images/".$folder_name."/";
$path="$filedir";
$j=0;
for($i=1;$i<=14;$i++) {
$files="afile".$i;
if(${$files}!="none") {
if(file_exists($path.${$files."_name"})) {
$same_name[$j]=${$files."_name"};
$j=$j+1;
$flag="False";
}
else
$flag="True";
}
}
if ($flag=="True") {
for($i=1;$i<=14;$i++){
$files="afile".$i;
if(${$files}!="none") {
if(copy(${$files},$path.${$files."_name"})) {
$pic.="$folder_name/${$files."_name"}:";
}
} }
print "指定图片上传成功!现在进入内容发布页面。<br>请稍后......";
echo "<meta http-equiv=\"refresh\" content=\"1; url=news_post.php?pic=$pic&cata=$cata\">";
exit ;
}
else {
echo "上传错误,在指定目录 $show_dir/$filedir 下已经存在已经图片:<br>" ;
for ($i=0;$i<$j;$i++) {
echo "<a href=$show_dir/$filedir$same_name[$i] target=\"_blank\">$same_name[$i]</a>  ";
}
echo "<p>如果要上传的图片与此图片的内容不同,请更改名称在试!";
echo "10秒中后自动返回图片发布处或点击<a href=news_load.php>这里</a>......";
echo "<meta http-equiv=\"refresh\" content=\"10; url=$filename\">";
exit();
}
}
?>
<body topmargin="0" leftmargin="0" rightmargin="0">
<form name=form method="post" action="news_load.php" enctype="multipart/form-data">
<div align="center"> <center>
<table border="0" cellpadding="0" cellspacing="1" width="100%" height="454" bgcolor="#1B356B">
<tr>
<td width="100%" height="34" colspan="4" >
<p align="center"><b><font color="#FFFFFF">●发布内容所需图片上传●</font></b></td>
</tr>
<tr bgcolor="#CCCCCC">
<td width="100%" height="30" colspan="4" ><b> ● </b>注:<font color="red">* </font>如果内容为转载,发布图片的顺序按原序</td>
</tr>
<tr>
<td width="100%" height="30" bgcolor="#CCCCCC" colspan="4" > <b>● </b>
按“浏览”按纽选择你要上传的图片</td>
</tr>
<tr>
<td width="9%" height="26" bgcolor="#FFF8E8" > <font color="red">* </font>图片1
</td>
<td width="33%" height="26" bgcolor="#FFF8E8" > <input type="file" name="afile1" style="WIDTH: 282px">
</td>
<td width="10%" height="26" bgcolor="#FFF8E8" > <font color="red">* </font>图片8
</td>
<td width="48%" height="26" bgcolor="#FFF8E8" > <input type="file" name="afile8" style="WIDTH: 282px">
</td>
</tr>
<tr>
<td width="9%" height="26" bgcolor="#FFF4E0" ><font color="red"> * </font>图片2 </td>
<td width="33%" height="26" bgcolor="#FFF4E0" ><input type="file" name="afile2" style="WIDTH: 282px"> </td>
<td width="10%" height="26" bgcolor="#FFF4E0" ><font color="red"> * </font>图片9</td>
<td width="48%" height="26" bgcolor="#FFF4E0" ><input type="file" name="afile9" style="WIDTH: 282px">
</td>
</tr>
<tr>
<td width="9%" height="26" bgcolor="#FFF8E8" > <font color="red">* </font>图片3 </td>
<td width="33%" height="26" bgcolor="#FFF8E8" ><input type="file" name="afile3" style="WIDTH: 282px"> </td>
<td width="10%" height="26" bgcolor="#FFF8E8" ><font color="red"> * </font>图片10</td>
<td width="48%" height="26" bgcolor="#FFF8E8" ><input type="file" name="afile10" style="WIDTH: 282px">
</td>
</tr>
<tr>
<td width="9%" height="26" bgcolor="#FFF4E0" > <font color="red">* </font>图片4 </td>
<td width="33%" height="26" bgcolor="#FFF4E0" ><input type="file" name="afile4" style="WIDTH: 282px"> </td>
<td width="10%" height="26" bgcolor="#FFF4E0" ><font color="red"> * </font>图片11</td>
<td width="48%" height="26" bgcolor="#FFF4E0" > <input type="file" name="afile11" style="WIDTH: 282px">
</td>
</tr>
<tr>
<td width="9%" height="26" bgcolor="#FFF8E8" ><font color="red"> * </font>图片5 </td>
<td width="33%" height="26" bgcolor="#FFF8E8" ><input type="file" name="afile5" style="WIDTH: 282px"> </td>
<td width="10%" height="26" bgcolor="#FFF8E8" ><font color="red"> * </font>图片12</td>
<td width="48%" height="26" bgcolor="#FFF8E8" ><input type="file" name="afile12" style="WIDTH: 282px">
</td>
</tr>
<tr>
<td width="9%" height="26" bgcolor="#FFF4E0" ><font color="red"> * </font>图片6 </td>
<td width="33%" height="26" bgcolor="#FFF4E0" ><input type="file" name="afile6" style="WIDTH: 282px"> </td>
<td width="10%" height="26" bgcolor="#FFF4E0" ><font color="red"> * </font>图片13</td>
<td width="48%" height="26" bgcolor="#FFF4E0" ><input type="file" name="afile13" style="WIDTH: 282px">
</td>
</tr>
<tr>
<td width="9%" height="26" bgcolor="#FFF8E8" > <font color="red">* </font>图片7 </td>
<td width="33%" height="26" bgcolor="#FFF8E8" ><input type="file" name="afile7" style="WIDTH: 282px"> </td>
<td width="10%" height="26" bgcolor="#FFF8E8" ><font color="red"> * </font>图片14</td>
<td width="48%" height="26" bgcolor="#FFF8E8" ><input type="file" name="afile14" style="WIDTH: 282px">
</td>
</tr>
<tr bgcolor="#CCCCCC">
<td width="100%" height="28" colspan="4" > <input type="submit" name="submit" value="确定上传">
<input type="reset" name="seret" value="全部重选"> </td></form>
</tr>
<tr>
<td width="100%" height="220" colspan="4" ><font color="#FFFFFF">使用说明:<br>
<br>
1,选择上传图片的目录(既内容即将发布的目录),系统默认上传文件到选定目录的images/目录下<br>
<br>
2,选中每次要发布内容需要的全部图片,如果图片超过了12个,请不发布此文章,并与管理员联系需要的图片<br>
<br>
3,不足12个是,希望能按次序选中,每次传完文件后程序会自动转到内容发布处<br>
<br>
注意事项:<br>
<br>
1,每次使用必须是先传图片在发布内容<br>
<br>
2,此程序仅供站点成员使用,在使用完毕后请使用系统提供的推出按钮退出系统<br>
<br>
3,如果不是使用退出按纽,在网吧使用的时候请务必关闭所有的浏览器窗口<br>
</font></td>
</tr>
<tr>
<td width="100%" height="8" colspan="4" >
<hr size="1" width="98%">
</td>
</tr>
<tr>
<td width="100%" height="18" colspan="4" >
<p align="center"><font color="#FFFFFF">程序制作:中国网络支持——宇安
版权所有:中国网络支持</font></td>
</tr>
</table>
</center>
</div></body>
这个演示版本在哪里?
我看看效果我拷过去不能用。
有几个require的
<head>
<title></title>
<meta name="generator" content="Turbo PHP">
<meta name="description" content="">
<meta name="keywords" content="">
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080">
<!-- Insert Your code here-->
<?PHP
if($upfile_name=="")
{
?>
<center><font size="6" color="red">上传文件示例</font>
<form ENCTYPE="multipart/form-data" action="test3-4.php" method="post">
<input type="file" name="upfile">
<input type="submit" value="上传">
</form>
</center>
<?PHP
}
else
{ if(file_exists("upfile/".$upfile_name)) //上传的文件放在upfile目录下面
{
echo("<center>文件已经存在</center>");
exit;
}
if(copy($upfile,"upfile/".$upfile_name))
{
echo("<center>上传完毕");
echo"<br>upfile_name: ".$upfile_name;
echo"<br>upfile_size: ".$upfile_size;
echo"<br>upfile_type: ".$upfile_type;
echo"<br><a href='javascript:history.back();'>BACK</a></center>";
}
else
{
echo("<center>上传失败</center>");
}
}
?>
</body>
</html>
看一下就明白了