Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feed.xsnews.nl!border-1.ams.xsnews.nl!takemy.news.telefonica.de!telefonica.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="UTF-8" Message-ID: <1504793.Zb9mryafdB@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Tue, 02 Oct 2012 21:43:15 +0200 User-Agent: KNode/4.4.11 Content-Transfer-Encoding: 8Bit X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. <2953112.VveF1GjdCU@PointedEars.de> <5065817e$0$6883$e4fe514c@news2.news.xs4all.nl> <6300879.mfXoyHR8pD@PointedEars.de> <506a0d4c$0$6932$e4fe514c@news2.news.xs4all.nl> Followup-To: comp.lang.javascript MIME-Version: 1.0 Lines: 97 NNTP-Posting-Date: 02 Oct 2012 21:43:15 CEST NNTP-Posting-Host: 88282103.newsspool3.arcor-online.net X-Trace: DXC=QbG;7^]b9Ikm7>ihJR;B_cMcF=Q^Z^V3h4Fo<]lROoRa8kF`76jB "Thomas 'PointedEars' Lahn" wrote: >>>> pointer: > […] > > I can get this to work. (A related useful article that I found through > your pointer was > en-US/docs/Using_files_from_web_applications>). ACK. > But as you say in the reference, the prefered way is to let the work be > done by the form's submit() method. Not only is it prefered, it is > mandatory if you don't want to limit the use to the most modern browsers. You misunderstood. I said that a form not using client-side scripting and only a plain submit button, or something else that submits the form is the *simplest* solution. But it has the drawback that in many cases the file content must be transferred to the server before it can be decided whether the file should have been submitted in the first place. And the server can only send (at least) one full HTML document as response. If you use more advanced client-side scripting, you can reduce unnecessary roundtrips and provide immediate feedback to the user in case their user agents supports that. Immediate feedback increases the responsiveness of the application, which in turn improves the user experience it provides. > IE8 doesn't support files, FileReader(), etc. True. But that does not mean that other users cannot be provided with a better experience. Graceful degration means that you can do a better thing without leaving the good one. > So I also played around with >
enctype="multipart/form-data"> type="submit">
On the server end, the processing is virtually the > same. And it works: a true copy of the selected file ends up on the > server. Ain't that marvellous! Of course. That has worked at least since HTML 4.01 became a W3C Recommendation (1999). > Now for my ignorance: using the form submit, the connection will be > terminated (gracefully) after the upload. Most certainly it will not. The HTTP version preferred by clients in user agents today is HTTP/1.1, which uses persistent connections per default. > (That does not happen when using the script route.) Ex falso quodlibet. > The transmission details of the submit() are: > POST /990727605?event=fileUpload HTTP/1.1 > Host : 127.0.0.1:88 > Connection : keep-alive This header field is included in requests for compatibility with HTTP/1.0 servers, and in responses for compatibility with HTTP/1.0 clients, respectively; see RFC 2068 (OBSOLETE), section 19.7.1. > Content-Length : 3112 > Content-Type : multipart/form-data; > boundary=---------------------------18756118404966 > Accept : text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 > Start of POSTstream : > -----------------------------18756118404966 > Content-Disposition: form-data; name="file"; filename="PRNshow.txt" > Content-Type: text/plain > > > My concern is that the server closes the connection after the submit(). Is > that to be expected/can it be avoided? No/yes. > The detail says 'keep-alive'. Which is what most certainly happens. > Where to go from here? You should read RFC 2616 "Hypertext Transfer Protocol -- HTTP/1.1", section 19.6.2, and sections and RFCs referred there. PointedEars -- Use any version of Microsoft Frontpage to create your site. (This won't prevent people from viewing your source, but no one will want to steal it.) -- from (404-comp.)