在WinForm中通过HTTP协议向服务器端上传文件(13) /// Adds POST form variables to the request buffer. /// HttpPostMode determines how parms are handled. /// 1 - UrlEncoded Form Variables. Uses key and value pairs (ie. "Name","Rick") to create URLEncoded content /// 2 - Multi-Part Forms - not supported /// 4 - XML block - Post a single XML block. Pass in as Key (1st Parm) /// other - raw content buffer. Just assign to Key. /// </summary> /// <param name="Key">Key value or raw buffer depending on post type</param> /// <param name="Value">Value to store. Used only in key/value pair modes</param> public void AddPostKey(string Key, byte[] Value) {
if (this.oPostData == null) { this.oPostStream = new MemoryStream(); this.oPostData = new BinaryWriter(this.oPostStream); }
if (Key == "RESET") { this.oPostStream = new MemoryStream(); this.oPostData = new BinaryWriter(this.oPostStream); }