您好:这个就是涉及到FileUpload的用法。给你个例子:
这就是上传按钮的后台事件。
如果上传的是图片可以转为2进制流存入数据库。如果是文件的话就存在服务器相应路径的磁盘下吧。
望采纳,谢谢。
给你一个类,找添加FileUpload的id就能上传并且会有你可能想要的。
#region
图片上传
private
static
string
_MSG
private
string
_ofullname
=
"0"
private
string
_tfullname
=
"0"
private
string
_ofilename
=
"0"
private
string
_tfilename
=
"0"
private
int
_limitwidth
=
3072
private
int
_limitheight
=
2304
private
int
_twidth
=
100
private
int
_theight
=
100
private
int
_size
=
3000000
private
bool
_israte
=
true
private
string
_path
=
"Images/CardUpload"
///
<summary>
///
信息
///
</summary>
public
static
string
MSG
{
get
{
return
_MSG
}
set
{
_MSG
=
value
}
}
///
<summary>
///
保存时的完整路径.原图
///
</summary>
public
string
OFullName
{
get
{
return
_ofullname
}
set
{
_ofullname
=
value
}
}
///
<summary>
///
保存时的完整路径.缩略图
///
</summary>
public
string
TFullName
{
get
{
return
_tfullname
}
set
{
_tfullname
=
value
}
}
///
<summary>
///
保存时的图片名称.原图
///
</summary>
public
string
OFileName
{
get
{
return
_ofilename
}
set
{
_ofilename
=
value
}
}
///
<summary>
///
保存时的图片名称.缩略图
///
</summary>
public
string
TFileName
{
get
{
return
_tfilename
}
set
{
_tfilename
=
value
}
}
///
<summary>
///
限定宽度
///
</summary>
public
int
LimitWidth
{
get
{
return
_limitwidth
}
set
{
_limitwidth
=
value
}
}
///
<summary>
///
限定高度
///
</summary>
public
int
LimitHeight
{
get
{
return
_limitheight
}
set
{
_limitheight
=
value
}
}
///
<summary>
///
缩略图宽度
///
</summary>
public
int
TWidth
{
get
{
return
_twidth
}
set
{
_twidth
=
value
}
}
///
<summary>
///
缩略图高度
///
</summary>
public
int
THeight
{
get
{
return
_theight
}
set
{
_theight
=
value
}
}
///
<summary>
///
文件大小
///
</summary>
public
int
Size
{
get
{
return
_size
}
set
{
_size
=
value
}
}
///
<summary>
///
是否成比例
///
</summary>
public
bool
IsRate
{
get
{
return
_israte
}
set
{
_israte
=
value
}
}
///
<summary>
///
是否生成缩略图
///
</summary>
public
bool
IsCreate
{
get
{
return
_israte
}
set
{
_israte
=
value
}
}
///
<summary>
///
存放图片的文件夹名称
///
</summary>
public
string
Path
{
get
{
return
_path
}
set
{
_path
=
value
}
}
///
<summary>
///
图片上传(默认:"等比压缩,限定上传尺寸2048*1536,缩略图尺寸100*100,限定上传大小1MB,存放在根目录UpdateImage中")
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)