• λ我爱Aspx >> Asp.Net >> WebService上传下载文件实例
  • WebService上传下载文件实例

  • :未知  Դ:非寒日志  :2007-4-21 0:46:59  ؼ:web,webservice
  • 二:通过Web Services上载文件

    向服务器上载文件可能有许多种方法,在利用Web Services上载文件的方法中,下面的这个方法应该是最简单的了。我们仍象前面的例子那样,首先建立Upload.asmx文件,其Upload.asmx.cs内容如下,里面已经做了注释:

    using System;

    using System.Collections;

    using System.ComponentModel;

    using System.Data;

    using System.Diagnostics;

    using System.Web;

    using System.Web.Services;

    using System.IO;

    namespace xml.sz.luohuedu.net.aspxWebCS

    {

    /// <summary>

    /// Upload 的摘要说明。

    /// </summary>

    [WebService(Namespace="http://xml.sz.luohuedu.net/",

    Description="在Web Services里利用.NET框架进上载文件。")]

    public class Upload : System.Web.Services.WebService

    {

    public Upload()

    {

    //CODEGEN:该调用是 ASP.NET Web 服务设计器所必需的

    InitializeComponent();

    }

    #region Component Designer generated code

    //Web 服务设计器所必需的

    private IContainer components = null;

    /// <summary>

    /// 设计器支持所需的方法 - 不要使用代码编辑器修改

    /// 此方法的内容。

    /// </summary>

    private void InitializeComponent()

    {

    }

    /// <summary>

    /// 清理所有正在使用的资源。

    /// </summary>

    protected override void Dispose( bool disposing )

    {

    if(disposing && components != null)

    {

    components.Dispose();

    }

    base.Dispose(disposing);

    }

    #endregion

    [WebMethod(Description="Web 服务提供的方法,返回是否文件上载成功与否。")]

    public string UploadFile(byte[] fs,string FileName)

    Ҷƪл˵?
  • һƪ用asp自动解析网页图片并保存
    һƪData Access Application Block 2.0