文件1.
<script type="text/javascript" >
function checkRowsLimit()
{
    var rowLimit = 20;
    var len=ElementById('filearea').rows.length;
inputtypefile不上传文件    if(len==rowLimit)
    {
        alert('一次只能添加20个图片!');
        return false;
    }
    else
    {
        return true;
    }
}
function addNewRow()
{
    var obj=ElementById('filearea');
    var row=obj.insertRow(-1);
    var c0=row.insertCell(0);
    c0.innerHTML='<input type=hidden size=3 maxlength=8 name=question value="" /> ';
    c0.align='right';
    var c1=row.insertCell(1);
    c1.innerHTML=+ElementsByTagName("u").length+1+'<u><input type=file size=50 maxlength=50 name="pictures'+ElementsByTagName("u").length+1+'"   /></u>';
    c1.align='left';
    var c2=row.insertCell(2);
    c2.innerHTML='<a href="javascript:void(0)" onclick="removeRow(this)">[删除]</a>';
    changeFlag = true;
    try
    {
        comm_set_page_height();   
    }
    catch (e)
    {
    }
}
function removeRow(fontobj)
{
    if(confirm("确定取消该项吗?"))
    {
        var obj=ElementById('filearea');
        var n=fontobj.wIndex;
        obj.deleteRow(n);
    }
}
</script>
<body>
<div align="center"><font size=4>ASP图片批量上传<br><br></font>
<font size=2 color=red>注:上传格式为.jpg,png,gif,bmp,jpeg</font></div>
<form action="poto_up.asp" method="post" enctype="multipart/form-data"  >
    <table width="561" border="0"  id="filearea" align="center">
        <tr>
          <td width="27" align=right><input type="hidden"  maxLength=8 size=3 name=question /></td>
            <td width="469" align=left>1<u><input type="file"  style="MARGIN-LEFT: 1px" maxLength=50 size=50 name="pictures1"  /></u></td>
        <td width="54"><a href="#" onClick="if(checkRowsLimit()) {addNewRow();changeFlag=true}" title="点击后在上面添加的输入框">[添加]</a></td>
        </tr>
</table>
<input type="hidden" name="act" value="uploadfile">
<div align="center"><br><input type="submit" name="upload" value="上传"  /></div>
</body>
<form>
文件二
<%
'=====================================
'此代码功能强大,经改动后可以用于各种图片上传及产品图片上传
'技术支持:QQ 757187785
'=====================================
%>
<%
function getex(filename)  '取图片后缀名
getex = right(filename,(len(filename)-InStr(filename,".")))
End Function
dim upload,file,formName,formPath,fname,getfilename
set upload=new upload_5xsoft
formPath=upload.form("filepath") '目前是当前路径 可以改成 "./123/"
for each formName in upload.objFile
set file=upload.file(formName)
'上传图片格式
if LCase(getex(file.filename))="jpg" or LCase(getex(file.filename))="png" or LCase(getex(file.filename))="gif" or LCase(getex(file.filename))="bmp" or LCase(getex(file.f
ilename))="jpeg"  then
if file.FileSize<=0 then
call ShowError("无效文件!")
end if
if file.FileSize>0 then
fname = now()
fname = replace(fname,"-","")
fname = replace(fname," ","")
fname = replace(fname,":","")
fname = replace(fname,"PM","")
fname = replace(fname,"AM","")
fname = replace(fname,"上午","")
fname = replace(fname,"下午","")
fname = fname&Int((right(fname,4) - 0 + 1) * Rnd + 0)
file.SaveAs Server.mappath(formPath&fname&"."&getex(file.filename)) '保存
end if
set file=nothing
i=i+1
else
response.Write("<script language='javascript'>alert('"&file.filename&"不是图片格式不能上传')</script>")
end if
next
response.Write("<script language='javascript'>alert('上传成功');(-1);</script>")
%>
文件三
<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>
dim Data_5xsoft
Class upload_5xsoft
 
dim objForm,objFile,Version
Public function Form(strForm)
  strForm=lcase(strForm)
  if ists(strForm) then
    Form=""
  else
    Form=objForm(strForm)
  end if
end function
Public function File(strFile)
  strFile=lcase(strFile)
  if ists(strFile) then
    set File=new FileInfo
  else
    set File=objFile(strFile)
  end if
end function
Private Sub Class_Initialize
  dim RequestData,sStart,vbCrlf,sInfo,iInfoStart,iInfoEnd,tStream,iStart,theFile
  dim iFileSize,sFilePath,sFileType,sFormValue,sFileName
  dim iFindStart,iFindEnd
  dim iFormStart,iFormEnd,sFormName
  Version="化境HTTP上传程序 Version 2.1"
  set objForm=Server.CreateObject("Scripting.Dictionary")
  set objFile=Server.CreateObject("Scripting.Dictionary")
  if Request.TotalBytes<1 then Exit Sub
  set tStream = Server.CreateObject("adodb.stream")
  set Data_5xsoft = Server.CreateObject("adodb.stream")

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。