• ----:)欢迎访问源码网(:----
    • 首页
    • 博客
    • 学院
    • 下载
    • 论坛
    • 影视
    • 发布源码
    • RSS
    • ITPig
    • 笑话网
    • 百家姓
    • 繁體中文

源码网 - 中国第一源码门户
选择镜像:网通镜像 - 电信主站
  • 首 页
  • 新闻动态
  • 网站运营
  • 网页制作
  • WEB开发
  • 编程开发
  • 图像媒体
  • 操作系统
  • 数据库
  • 服务器
热门搜索 优化 SEO 故事 cms IIS7 MySQL 个人 AdSense 主题推广 | 文章搜索: 高级搜索
会员登录/控制面版您的位置: 学院首页 >> WEB开发 >> ASP开发 >> 系统相关 >> 详细内容
 

推荐文章

 
 

热点文章

  • ASP+中文教程
  • 展现 C#
  • ASP+上传文件语法
  • 如何在ASP+中发送邮件
  • asp+的几个特点
  • ASP控制计算机函数ADSI发表
  • asp+初体验---用c#写的asp+域名查询程序
  • ASP+中执行简单的Select查询,并返回数据表到DataGrid
  • ASP+数据库操作例子
  • ASP+ 跟踪
  • 一份ASP内存的释放的实验报告
  • ASP+页缓存OutputCache Duration用法
 
 

相关文章

  • ASP+中GetTitleAuthors和PutTitleAuthors应用例子
  • ASP+页缓存OutputCache Duration用法
  • ASP+中执行简单的Select查询,并返回数据表到DataGrid
  • 让您的主页支持各种浏览设备(ASP+篇)
  • ASP+培训教材
  • 如何在ASP+中发送邮件
  • ASP+数据库操作例子
  • 转换ASP到ASP+
  • asp+与asp的区别
  • 突破性的ASP+技术
  • asp+语法介绍
  • Active Server Pages + 介绍
 
 

百度搜索

 
 

ASP+上传文件语法

  • 阅览次数:
  • 文章来源: 网海之贝
  • 原文作者: 佚名
  • 整理日期: 2006-10-03
  • 发表评论
  • 字体大小:
  • 小
  • 中
  • 大

这里有一个怎样用ASP+上传文件的非常简单例子
<html>

   <script language="VB" runat=server>

       Sub UploadBtn_Click(Sender as Object, E as EventArgs)

          UploadFile.PostedFile.SaveAs(Server.MapPath("test.jpg"))
         MyImage.ImageUrl = "test.jpg"
         MyImage.Visible = true

       End Sub

    </script>

    <body>

      <form enctype="multipart/form-data" runat=server>

          <h3>

           选择上传文件: <input id="UploadFile" type=file runat=server>

          <asp:button Text="Upload Me!" OnClick="UploadBtn_Click" runat=server/>

          <hr>

          <asp:image id="MyImage" Visible=false runat=server/>

     </form>

   </body>
</html>


Here is a more complex example, which enables you to upload a file, and then using the System.Drawing APIs
to resize/crop the image, overlay a custom text message onto the image, and then save it back out to disk
as a .jpg (note that this sample works with *any* browser).  I've written this one in C# -- but you would
obviously be able to use VB or JScript to do it as well:

<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Imaging" %>

<html>

<script language="C#" runat=server>

     void UploadBtn_Click(Object sender, EventArgs e) {

         UploadFile.PostedFile.SaveAs(Server.MapPath("test.jpg"));
         ImageEditor.Visible = true;
      }

      void UpdateBtn_Click(Object sender, EventArgs e) {

         System.Drawing.Image image = System.Drawing.Image.FromFile(Server.MapPath("test.jpg"));
         System.Drawing.Image newimage = new Bitmap(image.Width, image.Height, PixelFormat.Format32bppRGB);

         Graphics g = Graphics.FromImage(newimage);
         g.DrawImage(image,0,0,image.Width,image.Height);
         Font f = new Font("Lucida Sans Unicode", Int32.Parse(FontSize.SelectedItem.Text));
         Brush b = new SolidBrush(Color.Red);
         g.DrawString(Caption.Text, f, b, 10, 140);
         g.Dispose();

         System.Drawing.Image thumbImage = newimage.GetThumbnailImage(Int32.Parse(Width.Text),Int32.Parse
(Height.Text),null,0);
         image.Dispose();

         thumbImage.Save(Server.MapPath("test.jpg"), ImageFormat.JPEG);
      }

   </script>

   <body>

     <form enctype="multipart/form-data" runat=server>

          <h3>

          Select File To Upload: <input id="UploadFile" type=file runat=server>

          <asp:button Text="Upload Me!" OnClick="UploadBtn_Click" runat=server/>

          <hr>

          <asp:panel id="ImageEditor" Visible=false runat=server>

             <img src="test.jpg">

             <h3>
                Image Width: <asp:textbox id="Width" runat=server/>

                 Image Height: <asp:textbox id="Height" runat=server/> <br>

                 Text Caption: <asp:textbox id="Caption" runat=server/>

                 Caption Size: <asp:dropdownlist id="FontSize" runat=server>
                                         <asp:listitem>14</asp:listitem>
                                         <asp:listitem>18</asp:listitem>
                                         <asp:listitem>26</asp:listitem>
                                         <asp:listitem>36</asp:listitem>
                                         <asp:listitem>48</asp:listitem>
                                         <asp:listitem>62</asp:listitem>
                                      </asp:dropdownlist>

                 <asp:button Text="Update Image" OnClick="UpdateBtn_Click" runat=server/>

             </h3>
          </asp:panel>

      </form>

   </body>
</html>
       

上一篇:PHP编程技巧:看实例学正则表达式
下一篇:构建支持Master/Slave读写分离的数据库操作类
  • 网友评论:
  • 查看所有评论
  • 我要发表评论
您的网名:
留言主题:
你要发表的内容:

 

关于本站 | 广告联系 | 版权声明 | 网站地图 | 发布软件 | 帮助中心 | 源码论坛

Copyright © 2005-2007 CodePub.Com  程序支持:木翼  滇ICP备05005971号