源碼
using System;
using System
using System
using System
using System
using System
public partial class _Default : System
{
protected void Page_Load(object sender
{
//MyBlog:
}
protected void Button
{
#region 文件類型判斷
//得到上傳文件名
string FileName = FileUpload
//判斷文件名中有木有
if (!(FileName
{
Response
return;
}
//取到
int index = FileName
char[] c = FileName
string File_hz =
//循環得到後綴名
for (int i =
{
File_hz += c[index + i];
}
//允許上傳的文件名
string[] FileType = {
bool bl = false;
//循環遍歷上傳的文件擴展名是否在允許的擴展名中
foreach (string str in FileType)
{
if (str == File_hz)
{
bl = true;
}
}
if (bl == false)
{
Response
return;
}
#endregion
//獲取時間戳給文件命名
DateTime starttime = TimeZone
DateTime newtime = DateTime
long utime = (long)Math
FileName = utime
//獲取文件字節數
string FileLenght = FileUpload
string FilePath = Server
//上傳
FileUpload
Response
}
}
From:http://tw.wingwit.com/Article/program/net/201311/12048.html