(仿163)Asp.Net多附件上传 [转贴]
对于asp.net程序,我们应该尽可能的提供一个便捷的用户接口,减少页面回传就是其中之一。
本文演示一次上传多个文件的方法,在客户端可以随意控制上传文件的个数,但是注意总文件大小不能过大,否则会有异常抛出。至于解决大文件上传的方法已经超出本文的讨论范围。
<注:大附件办法>
<
<configuration>
<system.web>
<httpRuntime maxRequestLength="10000"
useFullyQualifiedRedirectUrl="true"
executionTimeout="45"/>
</system.web>
</configuration>
需要将machine.config或web.config中的<httpRuntime> section的maxRequestLength值作相应的修改.
>
这里有一个要点大家不要忽略了,否则程序不能正常工作。
就是必须指定form的enctype="multipart/form-data" 属性
代码如下:
<%@ Page language="c#"
Codebehind="MultiAttchments.aspx.cs" AutoEventWireup="false"
Inherits="WebApplication3.MultiAttchments" %><!DOCTYPE HTML
PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" ><HTML>
<HEAD>
<script>
function AddAttachments()
{
document.getElementById('attach').innerText
相关文档:
Asp.Net清空页面所有textbox的几种方法总结
在Asp.Net中清空所有textbox有好几种方法,本文提供几种,供大家参考!
foreach( Control childControl in this.Controls )
{
if( childControl is TextBox )
((TextBox)childControl).Text = "";
}&n ......
/// <summary>
/// 提供经常需要使用的一些验证逻辑。 比如 邮箱是否合法
/// </summary>
public class Validator
{
/// <summary>
&nbs ......
1.asp.net呼叫js
view
plain
copy
to clipboard
print
?
Response.Write("<mce:script language=javascript><!--
");
Response.Write("alert('欢迎您 ');"
);
Response.Write("location.href='login.aspx';"
)& ......
这里我只摘取了原文的Code以供潜心研究.using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Configuration;
using System.Data.SqlClient;
using System.Web.Security;
using System.Data;
public ......