Path: csiph.com!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: Cezary Tomczyk Newsgroups: comp.lang.javascript Subject: Re: How to validate a file in a javascript Date: Mon, 29 Oct 2012 15:20:33 +0100 Organization: Aioe.org NNTP Server Lines: 22 Message-ID: References: <804583d9-ac09-492c-b488-8989cb13727c@googlegroups.com> NNTP-Posting-Host: RMrsF+s1qSnxq5Qkkqjnpw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com comp.lang.javascript:16947 W dniu 2012-10-29 09:57, Denis McMahon pisze: > On Sun, 28 Oct 2012 23:32:33 -0700, Katja wrote: > >>> I wouldn't trust on file extensions. As a just a warning for user then >>> >>> it is ok. Just my "5 cents". >>> >> I know but I still need it =) > > Javascript has no direct access to the filesystem. Thus, it can not > reliably determine the size of a file. At best, you can do (sub)string > comparisons and regex checks against a file name entered into a form > field. Not really. There is some possibilities. See: https://developer.mozilla.org/en-US/docs/Using_files_from_web_applications There is "but". File API must be implemented in browser. -- Cezary Tomczyk http://www.ctomczyk.pl/