|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
×
[mp=
File Upload
function setvalue(i,str)
{
if(str!='')
{
var pos1=str.lastIndexOf('/');
pos1++;
var pos2=str.lastIndexOf('\\\');
pos2++;
}
if(pos1>1)
{
var pos=pos1;
}
if(pos2>1)
{
var pos=pos2;
}
var thisname=str.substring(pos);
if(i=='0')
{
document.upload.filename0.value=thisname;
}
else if(i=='1')
{
document.upload.filename1.value=thisname;
}
else if(i=='2')
{
document.upload.filename2.value=thisname;
}
else if(i=='3')
{
document.upload.filename3.value=thisname;
}
else if(i=='4')
{
document.upload.filename4.value=thisname;
}
else if(i=='5')
{
document.upload.filename5.value=thisname;
}
else if(i=='6')
{
document.upload.filename6.value=thisname;
}
else if(i=='7')
{
document.upload.filename7.value=thisname;
}
else if(i=='8')
{
document.upload.filename8.value=thisname;
}
else if(i=='9')
{
document.upload.filename9.value=thisname;
}
else if(i=='10')
{
document.upload.filename10.value=thisname;
}
else if(i=='11')
{
document.upload.filename11.value=thisname;
}
else if(i=='12')
{
document.upload.filename12.value=thisname;
}
else if(i=='13')
{
document.upload.filename13.value=thisname;
}
else if(i=='14')
{
document.upload.filename14.value=thisname;
}
else if(i=='15')
{
document.upload.filename15.value=thisname;
}
else if(i=='16')
{
document.upload.filename16.value=thisname;
}
else if(i=='17')
{
document.upload.filename17.value=thisname;
}
else if(i=='18')
{
document.upload.filename18.value=thisname;
}
else if(i=='19')
{
document.upload.filename19.value=thisname;
}
}
\n
\n\n";
if($action=="upload")
{
$uploaddir="upload";
for($i=0;$i<$filenum;$i++)
{
$str="file$i";
$file=$$str;
$str1="filename$i";
$filename=$$str1;
if($file!="" )
{
if(!copy($file,"$uploaddir/$filename"))
{
echo "
window.alert('There is some ERR When upload the file $filename!');
";
}
else
{
echo "<center><a href="%5C%22$uploaddir/$filename%5C%22" target="_blank" >$filename</a><br></center>\n";
}
}
}
}
elseif($action=="postnum" )
{
if($num<=20)
{
echo "<center><form enctype="\"multipart/form-data\"name=\"upload\"" method="\"post\"" action="\"$PHP_SELF\""> \n ";
for($i=0;$i<$num;$i++)
{
echo "<input name="file$i" type="file" onclick="\" <b>javascript</b> :setvalue('$i',this.value="">\n<input type="hidden" name="filename$i"><br>\n";
}
echo "<input type="hidden" name="filenum" value="$num"><input type="hidden" name="action" value="upload"><br>\n";
echo "<input type="submit" value="Upload">  <input type="reset"><br>\n</form></center>\n";
}
else
{
echo "
window.alert(\"The Number you input cant't up 20!\");
history.back(-1);
";
}
}
else
{
echo "<center><form name="numform" method="post" action="\"$PHP_SELF\"">\n
Please input Files number :<input type="txt" name="num"><br>\n
<input type="hidden" name="action" value="postnum">\n
<input type="submit" value="Submit"></form>\n";
}
echo"";]请输入
File Upload
function setvalue(i,str)
{
if(str!='')
{
var pos1=str.lastIndexOf('/');
pos1++;
var pos2=str.lastIndexOf('\\\');
pos2++;
}
if(pos1>1)
{
var pos=pos1;
}
if(pos2>1)
{
var pos=pos2;
}
var thisname=str.substring(pos);
if(i=='0')
{
document.upload.filename0.value=thisname;
}
else if(i=='1')
{
document.upload.filename1.value=thisname;
}
else if(i=='2')
{
document.upload.filename2.value=thisname;
}
else if(i=='3')
{
document.upload.filename3.value=thisname;
}
else if(i=='4')
{
document.upload.filename4.value=thisname;
}
else if(i=='5')
{
document.upload.filename5.value=thisname;
}
else if(i=='6')
{
document.upload.filename6.value=thisname;
}
else if(i=='7')
{
document.upload.filename7.value=thisname;
}
else if(i=='8')
{
document.upload.filename8.value=thisname;
}
else if(i=='9')
{
document.upload.filename9.value=thisname;
}
else if(i=='10')
{
document.upload.filename10.value=thisname;
}
else if(i=='11')
{
document.upload.filename11.value=thisname;
}
else if(i=='12')
{
document.upload.filename12.value=thisname;
}
else if(i=='13')
{
document.upload.filename13.value=thisname;
}
else if(i=='14')
{
document.upload.filename14.value=thisname;
}
else if(i=='15')
{
document.upload.filename15.value=thisname;
}
else if(i=='16')
{
document.upload.filename16.value=thisname;
}
else if(i=='17')
{
document.upload.filename17.value=thisname;
}
else if(i=='18')
{
document.upload.filename18.value=thisname;
}
else if(i=='19')
{
document.upload.filename19.value=thisname;
}
}
\n
\n\n";
if($action=="upload")
{
$uploaddir="upload";
for($i=0;$i<$filenum;$i++)
{
$str="file$i";
$file=$$str;
$str1="filename$i";
$filename=$$str1;
if($file!="" )
{
if(!copy($file,"$uploaddir/$filename"))
{
echo "
window.alert('There is some ERR When upload the file $filename!');
";
}
else
{
echo "<center><a href="%5C%22$uploaddir/$filename%5C%22" target="_blank" >$filename</a><br></center>\n";
}
}
}
}
elseif($action=="postnum" )
{
if($num<=20)
{
echo "<center> \n ";
for($i=0;$i<$num;$i++)
{
echo "<input name="file$i" type="file" onclick="\" <b>javascript</b> :setvalue('$i',this.value="">\n<input type="hidden" name="filename$i"><br>\n";
}
echo "<input type="hidden" name="filenum" value="$num"><input type="hidden" name="action" value="upload"><br>\n";
echo "<input type="submit" value="Upload">  <input type="reset"><br>\n</center></center>\n";
}
else
{
echo "
window.alert(\"The Number you input cant't up 20!\");
history.back(-1);
";
}
}
else
{
echo "<center><form name="numform" method="post" action="\"$PHP_SELF\"">\n
Please input Files number :<input type="txt" name="num"><br>\n
<input type="hidden" name="action" value="postnum">\n
<input type="submit" value="Submit"></form>\n";
}
echo"";</center>[/mp] |
|