在以前的Web应用中,上传文件是个很麻烦的事,现在有了.NET,文件上传变得轻而易举。下面的这个例子实现了多文件上传功能。可以动态添加输入表单,上传的文件数量没有限制。代码如下:


 

在ASP.NET中实现多文件上传和insertAdjacentHTMLusing System;
在ASP.NET中实现多文件上传和insertAdjacentHTML
using System.Data;
在ASP.NET中实现多文件上传和insertAdjacentHTML
using System.Configuration;
在ASP.NET中实现多文件上传和insertAdjacentHTML
using System.Collections;
在ASP.NET中实现多文件上传和insertAdjacentHTML
using System.Web;
在ASP.NET中实现多文件上传和insertAdjacentHTML
using System.Web.Security;
在ASP.NET中实现多文件上传和insertAdjacentHTML
using System.Web.UI;
在ASP.NET中实现多文件上传和insertAdjacentHTML
using System.Web.UI.WebControls;
在ASP.NET中实现多文件上传和insertAdjacentHTML
using System.Web.UI.WebControls.WebParts;
在ASP.NET中实现多文件上传和insertAdjacentHTML
using System.Web.UI.HtmlControls;
在ASP.NET中实现多文件上传和insertAdjacentHTML
在ASP.NET中实现多文件上传和insertAdjacentHTML
public partial class Default6 : System.Web.UI.Page

在此再说一下insertAdjacentHTML

参数有两个,第一个,插入位置;第二个,插入内容;  
   
  第一个参数的意义:   
    
  [插在这里,值为"beforeBegin"]<div   id=test>[插在这里,值为"afterBegin"]    
   
  层内文字    
   
  [插在这里,值为"beforeEnd"]</div>[插在这里,值为"afterEnd"]    

另加一个类似功能的带删除功能的实例

在ASP.NET中实现多文件上传和insertAdjacentHTML<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
在ASP.NET中实现多文件上传和insertAdjacentHTML
<html xmlns="http://www.w3.org/1999/xhtml" >
在ASP.NET中实现多文件上传和insertAdjacentHTML
<head>
在ASP.NET中实现多文件上传和insertAdjacentHTML    
<title>无标题页</title>
在ASP.NET中实现多文件上传和insertAdjacentHTML
</head>
在ASP.NET中实现多文件上传和insertAdjacentHTML
<body>
在ASP.NET中实现多文件上传和insertAdjacentHTML
<input   type="button"   onclick="addline()"   value="增加一行">   
在ASP.NET中实现多文件上传和insertAdjacentHTML  
<table   border="1"   id="test">       
在ASP.NET中实现多文件上传和insertAdjacentHTML      
<tr>   
在ASP.NET中实现多文件上传和insertAdjacentHTML          
<td   colspan="2"><input   type="text"   name="tt[]"></td>   
在ASP.NET中实现多文件上传和insertAdjacentHTML      
</tr>   
在ASP.NET中实现多文件上传和insertAdjacentHTML  
</table>   
在ASP.NET中实现多文件上传和insertAdjacentHTML  
<input   type="submit">   
在ASP.NET中实现多文件上传和insertAdjacentHTML  
</form>   


 

相关文章:

  • 2021-09-08
  • 2021-05-17
  • 2021-09-18
  • 2022-12-23
  • 2022-12-23
  • 2021-05-22
猜你喜欢
  • 2021-07-12
  • 2021-10-27
  • 2022-12-23
  • 2021-09-11
  • 2021-08-19
  • 2022-12-23
相关资源
相似解决方案