Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!82.197.223.108.MISMATCH!feeder2.cambriumusenet.nl!feed.tweaknews.nl!193.141.40.65.MISMATCH!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="ISO-8859-1" Message-ID: <2953112.VveF1GjdCU@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Fri, 28 Sep 2012 10:48:36 +0200 User-Agent: KNode/4.4.11 Content-Transfer-Encoding: 7Bit X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. Followup-To: comp.lang.javascript MIME-Version: 1.0 Lines: 49 NNTP-Posting-Date: 28 Sep 2012 10:48:36 CEST NNTP-Posting-Host: a59b5830.newsspool1.arcor-online.net X-Trace: DXC=0ig`RKX:N6?Tia]Ho99G50ic==]BZ:af>4Fo<]lROoR1nkgeX?EC@@09]aE[9kcEZ=DZm8W4\YJN I use code like this: > var asyncRequestor = new XMLHttpRequest(); > var transmit = function(txt){ > asyncRequestor.open("POST",d2w.appID,true); > asyncRequestor.setRequestHeader("Content-type","application/x-www- form-urlencoded"); > asyncRequestor.send(txt); > }; > ... > transmit('origin='+origin+'&'+args); > to pass information about events to the server. That works as required > (thanks to help I got from you !). > > Now I come to a point where the content of a file needs to be transmitted, > like in: > function readLocalFile(file) { > var reader = new FileReader(); > reader.onload = > function(){transmit('origin='+file.name+'&'+this.result)}; > reader.readAsBinaryString(file); > } > > Questions: > 1. is this how a file's contents should be passed? No. > 2. is the content-type still correct? No. > 3. shouldn't this.result be encapsulated to cope with & and other unwanted > chars? Yes. It should be URL-encoded instead, unless you gzip it. > Or maybe you can point me to an example. I could not find anything useful. PointedEars -- Sometimes, what you learn is wrong. If those wrong ideas are close to the root of the knowledge tree you build on a particular subject, pruning the bad branches can sometimes cause the whole tree to collapse. -- Mike Duffy in cljs,