Skip to content

Instantly share code, notes, and snippets.

@akm
Last active May 14, 2018 04:26
Show Gist options
  • Save akm/441653ee0114d7e61780e0449f4a592e to your computer and use it in GitHub Desktop.
Save akm/441653ee0114d7e61780e0449f4a592e to your computer and use it in GitHub Desktop.

Setup

$ mkdir file_field_test1       
$ cd file_field_test1 
$ mkdir -p case1/foo
$ mkdir -p case2/foo
$ touch case1/foo/foo.txt
$ touch case2/foo/foo.txt
$ touch case2/bar.txt
$ echo '<input type="file" directory="" webkitdirectory="" onchange="console.log(this.files)"/>' > index.html

Operation

  1. open file_field_test1/index.html
  2. Select file_field_test1/case1
  3. Your Javascript Console
  4. Select file_field_test1/case2
  5. Your Javascript Console

Result

  • case1
    • webkitRelativePath of the element of files doesn't include case1
  • case2
    • Each webkitRelativePath of the elements of files includes case2
@akm
Copy link
Author

akm commented May 14, 2018

Screenshots

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment