http://community.csdn.net/Expert/TopicView1.asp?id=4978286提交目标为一个隐藏的iframe/frame即可
<form target="frameName"

解决方案 »

  1.   

    但是我们的需求是可以动态添加多个文件上传,所以下面的这段代码:
    <form name="muploadfile_19_form" method="post" enctype="multipart/form-data" action="/website/app?serviceId=MultiUpload&amp;muploaduid=muploadfile_19">
    <input type="text" style="border-width: 0px;" readOnly="true" onpropertychange="muploadfile_19_form.submit();" name="muploadfile_19_filetext">
    <input type="file" style="display: none;" onchange="document.getElementById('muploadfile_19_filetext').value=this.value" name="muploadfile_19_file">
    </form>
    会动态添加,这样iframe的高度不够的话会出滚动条的,这应该不是我们想要的
      

  2.   

    不是把这些东东放iFrame里是提交到iFrame里,这个iFrame是隐藏的<iFrame src="文件上传处理程序.asp" style="display:none" name="frmFileUp"></iFrame>把form的target设为iFrame的name
      

  3.   

    还是不行,首先iframe会在加载时自动请求处理上传文件的地址;这样的话服务器端会出错;然后就是我把form的action删除了,按照你们说得在form添加target="muploadfile_19_frame",但是还是报错拒绝访问;
    请问是不是我的代码哪里还有问题?
    谢谢
    <html>
    <body>
              <!--添加的隐藏iframe-->
    <iframe name="muploadfile_19_frame" src="/website/app?serviceId=MultiUpload&muploaduid=muploadfile_19" style="display:none"></iframe>
    <form name="muploadfile_19_form" method="post" enctype="multipart/form-data" target="muploadfile_19_frame">
    <input type="text" style="border-width: 0px;" readOnly="true" onpropertychange="muploadfile_19_form.submit();" name="muploadfile_19_filetext">
    <input type="file" style="display: none;" onchange="document.getElementById('muploadfile_19_filetext').value=this.value" name="muploadfile_19_file">
    </form>                   <!--测试-->
    <script language="javascript">
      document.getElementById('muploadfile_19_file').click();
    </script>
    </body>
    </html>
      

  4.   

    onchange="document.getElementById('muploadfile_19_filetext').value=this.value" input type=file在javascript语句中是只读的,不能用写
      

  5.   

    又看错了,抱歉啦
    action肯定是要加的
      

  6.   

    我也觉得我上面修改的不对,不应该把处理上传文件的页面地址写在iframe的src里,现在又改了一下,iframe的src="";form的target指向iframe的name,然后form的action是处理上传文件的页面地址,但是由js自动提交时还是报错“拒绝访问”,我快没辙了
    <html>
    <body>
    <iframe name="muploadfile_19_frame" src="" style="display:none"></iframe>
    <form name="muploadfile_19_form" method="post" enctype="multipart/form-data" target="muploadfile_19_frame" action="/website/app?serviceId=MultiUpload&muploaduid=muploadfile_19">
    <input type="text" style="border-width: 0px;" readOnly="true" onpropertychange="muploadfile_19_form.submit();" name="muploadfile_19_filetext">
    <input type="file" style="display: none;" onchange="document.getElementById('muploadfile_19_filetext').value=this.value" name="muploadfile_19_file">
    </form> <script language="javascript">
      document.getElementById('muploadfile_19_file').click();
    </script>
    </body>
    </html>