asp.net上传图片并同时生成缩略图
日期:2007年4月28日 作者: 查看:[大字体 中字体 小字体]-
<script language="VB" runat="server">
Sub UploadFile(sender As Object, e As EventArgs)If FileUp.PostedFile.ContentLength = 0 Then
FileInfo.Visible = False
Exit Sub
Else
FileInfo.Visible = True
FDisplay1.Visible = True
End IfFSize.Text ="上传文件大小"+ CStr(FileUp.PostedFile.ContentLength/1024)+"KB"
FName.Text = "已上传文件名:"+FileUp.PostedFile.FileName+"<br>"+FName.Text'写入数据库
on error resume next
dim myconn as sqlconnection
dim mycomm as sqlcommand
dim sql as string
dim id as integer
Dim image,anewimage As System.Drawing.Image
dim width,height,newwidth,newheight as integer
Dim callb As System.Drawing.Image.GetThumbnailImageAbort
myConn=New sqlconnection(ConfigurationSettings.AppSettings("数据库"))
myconn.open()
sql="insert into picture (姓名,班级,介绍,属性) values ('"&request.cookies("dgxyl").values("dgxylname")&"','"&request.cookies("dgxyl").values("dgxylbj")&"','"&trim(request("TextBox1"))&"','"&request("r1")&"')"
Mycomm=New sqlcommand(sql,myconn)
mycomm.executenonquery()
myconn.close()Dim myCommand As New SqlCommand("select top 1 id from picture order by id desc", myConn)
myCommand.Connection.Open()
Dim myReader As SqlDataReader=mycommand.executereader()
if myReader.Read() then
id=myReader("id")
end if
myconn.close()
'保存图片
FileUp.PostedFile.SaveAs( Server.MapPath("\classpic\")&cstr(id)&".jpg" )
'生成缩略图
image=System.Drawing.Image.FromFile(Server.MapPath("/classpic/"+cstr(id)+".jpg"))
width=image.Width
height=image.height
if width>height then
newwidth=250
newheight=image.height/image.Width*newwidth
else
newheight=250 - [1] [2] [3] 下一页
-
- asp.net上传图片并同时生成缩略图 相关文章:
- asp.net上传图片并同时生成缩略图 相关软件
- 特别声明:本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作
- 者.文章版权归文章原始作者所有.对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转
- 载的文章有版权问题请联系编辑人员,我们尽快予以更正. 转载请注明来源:http://www.hackhome.com
下一篇:DotNet语音技术实现
精品推荐
热点TOP10
- ·ASP函数库
- ·web.config 简单介绍
- ·GridView 分页导航
- ·ASP实用技巧28则
- ·基于PHP与XML的PDF文档生成技术
- ·ASP与存储过程实践(实例)
- ·20种看asp源码的方法及工具
- ·ASP.NET技术FAQ
- ·解密ASP源代码
- ·提高ASP性能的最佳选择
- ·用ASP编写的“俄罗斯方块游戏”
- ·无组件文件上传源代码
- ·跟我学小偷程序之几个基本函数(第二天)
- ·用ASP学做一个在线调查
- ·使用模板实现ASP代码与页面分离
- ·一个类似Listview的效果
- ·利用ASP打造网站论坛DIY
- ·一个xmlhttp读取xml的例子
- ·ASP漏洞及安全建议
- ·动网7.0 里的 UBB 和高级编辑模式如何分离出来大家使用
特别推荐
- ·在asp聊天室里实现房间功能和用户显示
- ·常用的 ASP ActiveX 组件
- ·用ASP学做一个在线调查
- ·微软建议的ASP性能优化28条守则
- ·ASP和服务器测试相关的一些代码
- ·ASP的错误处理集锦
- ·正则表达式regular expression详述(一)
- ·改进性能和样式的 24个 ASP 技巧
- ·ASP网站远程客户实现EXCEL打印功能
- ·DVBBS上传ASP文件漏洞详解
- ·ASP操作XML文件的完整实例
- ·无组件上传图片至SQLSERVER数据库
- ·使用模板实现ASP代码与页面分离
- ·用ASP创建Microsoft Word 文件
- ·用ASP开发WEB日期选择器
- ·用ASP编写的“俄罗斯方块游戏”
- ·无组件文件上传源代码
- ·一个xmlhttp读取xml的例子
- ·20种看asp源码的方法及工具
- ·在ASP页里面注册DLL的VBScript CLASS
