Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeder2.ecngs.de!ecngs!feeder.ecngs.de!border1.nntp.ams.giganews.com!nntp.giganews.com!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="ISO-8859-1" Message-ID: <2101068.cEeWsdYRzj@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Thu, 01 Nov 2012 21:51:34 +0100 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: 31 NNTP-Posting-Date: 01 Nov 2012 21:51:35 CET NNTP-Posting-Host: edac613d.newsspool2.arcor-online.net X-Trace: DXC=Im^eQO75[;gm7>ihJR;B_cA9EHlD;3Ycb4Fo<]lROoRa8kFK`JjkNj3FBJ;ii8jC0mN:QOl X-Complaints-To: usenet-abuse@arcor.de Xref: csiph.com comp.lang.javascript:17004 Jeff North wrote: > A couple of years ago I too wanted to validate the filetype the > visitor had selected before sending everything to the server. I > couldn't even access the filename because of security restrictions. > > It seems these days this restriction has been relaxed. I checked out > https://developer.mozilla.org/en- US/docs/Using_files_from_web_applications#Example.3A_Showing_file%28s%29_size > This works in FF 16, Opera 12, sort of in works in Chrome 22, hardly > works in Safari 5 and doesn't work in IE 9. > > Also check out the WHATWG description of type=file - > http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the- type-attribute.html#file-upload-state-%28type=file%29 > > So while there are some restrictions that have been lifted there is no > standard implementation of the new rules. So I guess it is back to > validating the file server-side. The Good Thing about using client-side scripting is that in many cases you actually can have the cake and eat it. This example is no exception. You can validate forms both client-side and server-side, providing users with user agents where client-side validation is possible with the additional benefits of providing immediate feedback and avoiding unnecessary roundtrips. PointedEars -- When all you know is jQuery, every problem looks $(olvable).