会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
过江的博客
博客园
首页
新随笔
管理
订阅
重新写的上传
public
static
int
FileSize;
const
string
UpFilePath
=
"
Fujian
"
;
protected
string
FileName;
protected
string
FileType;
protected
string
FilePath;
string
Mapname
=
null
;
string
[] up
=
this
.input_Annex_Name.PostedFile.FileName.Split(
new
char
[]
{
'
\\
'
}
);
string
p
=
MapPath(
""
)
+
"
\\
"
+
UpFilePath
+
"
\\
"
+
up[up.Length
-
1
];
if
(System.IO.File.Exists(p))
{
Websharp.WebUI.WebFunc.Alert(
"
该文件已经存在!
"
,Page);
}
else
{
string
[] Date
=
DateTime.Now.ToString().Split(
'
'
);
string
[] name1
=
Date[
0
].Split(
'
-
'
);
string
[] name2
=
Date[
1
].Split(
'
:
'
);
for
(
int
i
=
0
;i
<
3
;i
++
)
{
Mapname
+=
name1[i]
+
name2[i];
}
Mapname
=
Mapname
+
up[up.Length
-
1
];
string
AccessoryUrl
=
Server.MapPath(
"
..
"
)
+
"
\\FuJian\\
"
+
Mapname;
this
.input_Annex_Name.PostedFile.SaveAs(AccessoryUrl);
SingleTable st
=
new
SingleTable(
"
upload
"
);
string
title
=
this
.input_Annex_Name.PostedFile.FileName.Substring(
this
.input_Annex_Name.PostedFile.FileName.LastIndexOf(
"
\\
"
)
+
1
,
this
.input_Annex_Name.PostedFile.FileName.Length
-
this
.input_Annex_Name.PostedFile.FileName.LastIndexOf(
"
\\
"
)
-
1
);
string
src
=
AccessoryUrl;
DateTime dt
=
Convert.ToDateTime(System.DateTime.Now.ToShortDateString());
object
[] strValues ;
strValues
=
new
object
[]
{title,src,dt}
;
st.GetData(
"
insertupload
"
,strValues);
Websharp.WebUI.WebFunc.Alert(
"
上传成功!
"
,Page);
}
}
catch
{
Websharp.WebUI.WebFunc.Alert(
"
上传失败,请重新上传!
"
,Page);
}
posted on
2006-06-29 08:18
过江
阅读(
262
) 评论(
0
)
编辑
收藏
举报
会员力量,点亮园子希望
刷新页面
返回顶部
公告