Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #17004

Re: How to validate a file in a javascript

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> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Reply-To Thomas 'PointedEars' Lahn <cljs@PointedEars.de>
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+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v
Face iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg==
Subject Re: How to validate a file in a javascript
Newsgroups comp.lang.javascript
References <804583d9-ac09-492c-b488-8989cb13727c@googlegroups.com> <k6k8kh$svj$1@speranza.aioe.org> <b1e733ca-8409-410a-8f74-bf5c9a6014cc@googlegroups.com> <k6lgcv$vth$2@dont-email.me> <k6m3bf$u39$1@speranza.aioe.org> <k6n33i$938$2@dont-email.me> <oqnu885m3anro1lv49rppo1l7o60ghbt2k@4ax.com>
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<]lROoRa8kF<OcfhCOkZ`RZ1E_PbLoDZm8W4\YJNlJ`:FmdeL>K`JjkNj3FBJ;ii8jC0mN:QOl
X-Complaints-To usenet-abuse@arcor.de
Xref csiph.com comp.lang.javascript:17004

Followups directed to: comp.lang.javascript

Show key headers only | View raw


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).

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How to validate a file in a javascript Katja <kate.kokatjuhha@gmail.com> - 2012-10-28 11:56 -0700
  Re: How to validate a file in jquery Denis McMahon <denismfmcmahon@gmail.com> - 2012-10-28 21:11 +0000
  Re: How to validate a file in a javascript Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2012-10-28 22:38 +0100
    Re: How to validate a file in a javascript Katja <kate.kokatjuhha@gmail.com> - 2012-10-28 23:32 -0700
      Re: How to validate a file in a javascript Denis McMahon <denismfmcmahon@gmail.com> - 2012-10-29 08:57 +0000
        Re: How to validate a file in a javascript Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2012-10-29 15:20 +0100
          Re: How to validate a file in a javascript Denis McMahon <denismfmcmahon@gmail.com> - 2012-10-29 23:22 +0000
            Re: How to validate a file in a javascript Jeff North <jnorthau@yahoo.com.au> - 2012-10-30 17:11 +1100
              Re: How to validate a file in a javascript Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-11-01 21:51 +0100
        Re: How to validate a file in a javascript Dr J R Stockton <reply1244@merlyn.demon.co.uk.invalid> - 2012-10-30 19:47 +0000

csiph-web