コード例 #1
0
ファイル: Mtom.aspx.cs プロジェクト: hijushen/WindowDemo
    protected void btnUpload_Click(object sender, EventArgs e)
    {
        var proxy = new MessageSvc.Mtom.MtomClient();

        var length = file.PostedFile.ContentLength;
        var bytes = new byte[length];
        file.PostedFile.InputStream.Read(bytes, 0, length);

        try
        {
            proxy.UploadFile(
                txtDestination.Text + Path.GetFileName(file.PostedFile.FileName),
                bytes);
            Page.ClientScript.RegisterStartupScript(typeof(Page), "js", "alert('上传成功');", true);
        }
        catch (Exception ex)
        {
            Page.ClientScript.RegisterStartupScript(typeof(Page), "js", "alert('" + ex.ToString() + "');", true);
        }

        proxy.Close();
    }
コード例 #2
0
ファイル: Mtom.aspx.cs プロジェクト: QingleCheng/WindowDemo
    protected void btnUpload_Click(object sender, EventArgs e)
    {
        var proxy = new MessageSvc.Mtom.MtomClient();

        var length = file.PostedFile.ContentLength;
        var bytes  = new byte[length];

        file.PostedFile.InputStream.Read(bytes, 0, length);

        try
        {
            proxy.UploadFile(
                txtDestination.Text + Path.GetFileName(file.PostedFile.FileName),
                bytes);
            Page.ClientScript.RegisterStartupScript(typeof(Page), "js", "alert('上传成功');", true);
        }
        catch (Exception ex)
        {
            Page.ClientScript.RegisterStartupScript(typeof(Page), "js", "alert('" + ex.ToString() + "');", true);
        }

        proxy.Close();
    }