asp.net图片上传(带重命名)
点击按钮上传FileUpload的图片
protected void Button3_Click(object sender, ImageClickEventArgs e)
{
if (FileUpload1.HasFile)
{
//重命名图片
string strFileName1 = FileUpload1.FileName; //取到上传文件的名称
string[] myfile = strFileName1.Split('.'); //把文件名与文件类型分开
string dotname = myfile[myfile.Length - 1].ToString().ToLower(); //得到文件类型
if (dotname == "gif" || dotname == "jpg")
{
string filepath = Path.GetFullPath(FileUpload1.PostedFile.FileName);
Random myrdn = new Random(); //产生随机数
strFileName1 = DateTime.Now.ToString("yyMMddHHmm") + myrdn.Next(10000).ToString() + "." + dotname;
string imgpath = Server.MapPath("UserImg/");
string folder = "b
相关文档:
这里我只摘取了原文的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 ......
ASP.NET正则表达式集合
1.帐号由a~z的英文字母(不区分大小写)、0~9的数字、点、减号或下划线组成,长度为
3~18个字符,例如:kyzy_001
^[a-zA-Z0-9.-_]{3,18}$
2.输入框里必须为数字
^[0-9]{1,}$
3.电子邮件格式
\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*
4.要求文本框只能输入最多 ......
asp.net
http://topic.csdn.net/t/20060818/14/4959087.html
http://www.agrinei.com/gridviewhelper/gridviewhelper_en.htm
http://dotnet.aspx.cc/ShowDetail.aspx?id=149E5DD7-3B32-461e-ACC6-51D1652E6746
http://www.xueit.com/html/2009-08/21_4321_00.html
http://topic.csdn.net/t/20060429/10/4722766.html
......
引用using System.Web.UI.HtmlControls;
前台的<table id="mytab" border="1" runat="server" class="t1" width="600">
......