是在表单的 file 类型中浏览吗?
如果是,可以在 onChange 事件中检查各个输入的内容
如果是,可以在 onChange 事件中检查各个输入的内容
解决方案 »
- 谁有Ext Core ajax现成的实例贴一个上来参考下!!!!!求
- appendChild使用_谁给解答
- js中或(||)运算符的问题
- Javascript中的日期问题
- 一个超难问题,简繁转换中的图片问题?
- 帮忙解释一下
- select 中的东西怎么可以传到一个input
- 如何用javascript控制光標指定在text輸入框的位置
- window.parent.oa_middle.oa_userlist.document.location.reload();报错:对像为空或不存在
- jquery左侧导航二级打开之后又自动收起
- 怎么用javascript设计一个如同MSN的提示弹出窗口
- 寻找图文混排控件请帮忙(在Delphi里用)
和你说的意思差不多,我现在想同时上传多个文件到数据库,但如果文件相同的话会造成数据库当中同一个文件存储两次.
不知道你所说的检查是怎样实现的?
2 当你上传了一个a.txt的文件,下次再上传a.txt,你可用fso检查一下有没有重复。
3 上传过程中改名,改成唯一的不行吗?
<script language="JavaScript">
var i = 1;
function addFile()
{
i++;
var str = '<INPUT onclick="alert(this.name)" type="file" size="50" NAME="File'+i+'">';
document.getElementById('MyFile').insertAdjacentHTML("beforeEnd",str)
}
</script>
</HEAD>
<body>
<form name="form1" method="post" enctype="multipart/form-data"> <P id="MyFile"><INPUT type="file" onclick='alert(this.name)' size="50" NAME="File1"></P>
<P>
<input type="button" value="增加(Add)" onclick="addFile()">
<input type="submit" value="upload">
<input onclick="this.form.reset()" type="button" value="重置(ReSet)">
</P></form>
<script language="JavaScript">
var i = 1;
function addFile()
{
i++;
var str = '<INPUT onclick="alert(this.name)" type="file" size="50" NAME="File'+i+'">';
document.getElementById('MyFile').insertAdjacentHTML("beforeEnd",str)
}
</script>
</HEAD>
<body>
<form name="form1" method="post" enctype="multipart/form-data" onsubmit="this.num.value=i;alert('共有'+this.num.value+'个文件上传')">
<input type="hidden" name="num">
<P id="MyFile"><INPUT type="file" onclick='alert(this.name)' size="50" NAME="File1"></P>
<P>
<input type="button" value="增加(Add)" onclick="addFile()">
<input type="submit" value="upload">
<input onclick="this.form.reset()" type="button" value="重置(ReSet)">
</P></form>
<SCRIPT LANGUAGE="JavaScript">
<!--
function btnAttachment_onclick()
{
fileAttachment.click();
var StrFileValue=fileAttachment.value;
fileAttachment.select();
if (StrFileValue!="")
{
for (var i=0;i<sltFile.length;i++)
{
if (StrFileValue==sltFile.options[i].text)
{
alert("此文件已存在。")
}
}
var objOption = document.createElement("OPTION");
var strValue=StrFileValue;
var strText=strValue;
objOption.value=strValue;
objOption.text=strText;
sltFile.add(objOption);
}
}
function btnMove_onclick()
{
if (sltFile.selectedIndex<0) return false;
sltFile.remove(sltFile.selectedIndex);
} function sltFile_onclick() { if(sltFile.value=="")
{
return btnAttachment_onclick();
}
return true;
}
//-->
</SCRIPT>
<input type="file" id="fileAttachment" name="fileAttachment" class="button" onkeypress="return false;" style="display:inline;VERTICAL-ALIGN: middle; WIDTH:0px; position:absolute;clip: rect(0 0 0 0)">
<select size="1" id="sltFile" name="sltFile" class="select" style="width:400px;" LANGUAGE=javascript onclick="return sltFile_onclick()"> </select>
<button name="btnAttachment" id="btnAttachment" onclick="return btnAttachment_onclick();" accesskey="A" class="button">添加(<u>A</u>)</button>
<button name="btnMove" id="btnMove" onclick="return btnMove_onclick();" accesskey="M" class="button">去除(<u>M</u>)