[whatwg] "C:\fakepath\" in HTML5

Randy Drielinger Randy at ProWebDesign.nl
Sun Mar 29 04:49:25 PDT 2009

Referring to an example posted earlier:

> https://www.freedfm.com/
> Specifically, the following code:
> if((strFileName.indexOf("\\") == -1) && (strFileName.indexOf("/") == -1))
> {
>   alert("Please do not type your filename. Click Browse and upload your 
> zip file.");
>   document.fileupload.UploadFileData.focus();
>   return false;
> }

this specific example would still work (regardless of the fact that this 
type of code is so outdated, it could need some re-work ;-)

My alternative (or any similar proposal) is way better than C:\fakepath, 
ensuring cross-platform uniform (expected) behavior.

With the risk of repeating myself, are we forcing the specs to cover all 
possible exceptions JS-programmers create?

----- Original Message ----- 
From: "timeless" <timeless at gmail.com>
To: "Randy Drielinger" <Randy at prowebdesign.nl>
Cc: <whatwg at whatwg.org>
Sent: Sunday, March 29, 2009 9:47 AM
Subject: Re: [whatwg] "C:\fakepath\" in HTML5

> Randy Drielinger <Randy at prowebdesign.nl> wrote:
>> With the risk of not being compliant with other OS's, but isn't using
>> file://localpath/<real_file_name.extension> (so using file://localpath/ 
>> by
>> default)
>> the solution for the original suggestion?
>> This ensures not breaking anything on existing websites and is a far more
>> logical name for the whole workaround.
> How does using a number of /'s and <ZERO> \'s increase the likelihood
> of compatibility with web apps which are clearly looking for \'s?

More information about the whatwg mailing list