function FwAjax3(host, cb) { var req = function() { try{ return new XMLHttpRequest();} catch(e){} try{ return new ActiveXObject("Msxml2.XMLHTTP.6.0") }catch(e){} try{ return new ActiveXObject("Msxml2.XMLHTTP.3.0") }catch(e){} try{ return new ActiveXObject("Msxml2.XMLHTTP") }catch(e){} try{ return new ActiveXObject("Microsoft.XMLHTTP") }catch(e){} return null; }(), boundary = function () { var tmp = Math.random(); var thisDate = new Date(); tmp = Math.abs(tmp*thisDate.getTime()); tmp = "--------" + tmp + "--------"; return tmp; }(), createFile = function (_field, _value, _encoding) { var tmp = "--" + boundary + CRLF; tmp += "Content-Disposition: attachment; name=\"" + _field + "\"; filename=\"" + _value.name + "\"" + CRLF; tmp += "Content-Type: " + _value.type + CRLF; tmp += "Content-Transfer-Encoding: " + _encoding + CRLF + CRLF; tmp += _value.data + CRLF; // tmp += "--" + boundary + "--" + CRLF + CRLF; return tmp; }, createField = function (_field, _value) { var tmp = "--" + boundary + CRLF; tmp += "Content-Disposition: form-data; name=\"" + _field + "\"" + CRLF; tmp += "Content-Transfer-Encoding: chucked" + CRLF + CRLF; tmp += _value + CRLF; // tmp += "--" + boundary + "--" + CRLF + CRLF; return tmp; }, fields = [], files = [], CRLF = "\r\n"; req.onreadystatechange = function() { if(window.console) console.log(req.readyState); if(req.readyState == 4) { if(window.console) console.log(req.status); if(req.status == 200) { cb(req.responseText, req.responseXML); } } }; this.addFile = function(_field, _value, _encoding) { files.push([_field, _value, _encoding]); }; this.removeFile = function(_field) { for (var i=0; i