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(); }
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(); }