webkitdirectory directory

  • 1
  • Question
  • Updated 4 years ago
phonegap
for the
i plan to use:
webkitdirectory directory
to get the directory in android, but it failed~

Why and what is the solution.
Photo of Zack Hee

Zack Hee

  • 3 Posts
  • 0 Reply Likes
  • sad

Posted 4 years ago

  • 1
Photo of JesseMonroy650 (Volunteer)

JesseMonroy650 (Volunteer), Champion

  • 3325 Posts
  • 122 Reply Likes
@Zack
Since this is your first post, please answer the following question.
- Is this your first hybrid App?
- Are you using the Phonegap Desktop App?
- Are you using CLI, SDK or Build? Please do not assume the answer, please read the link.

Also, when posting code, please use some HTML (like <code></code>). (see attached image)


Jesse
Photo of Zack Hee

Zack Hee

  • 3 Posts
  • 0 Reply Likes
@JesseMonroy650

Hi,
I'm not sure what is a hybird App. I have developed apps with android studio, I started to develop an apps with Phonegap Build after a five day training With Mr. Tiki.

No, I'm not using the Phonegap Desktop App. I do coding with notepad++.

I'm using Build. I zipped the files, Uploaded to Phonegap. After that I download it to my smartphone and test it.

here is my code:


function readFiles(event) {
var fileList = event.target.files;
var string = "";
for(var i=0; i < fileList.length; i++ ) {
var file = fileList[i];
string += file.name;
}

document.getElementById("displayFileList").innerHTML = string;
}

<input type="file" onchange="readFiles(event)" webkitdirectory directory multiple></input>
<div id="displayFileList"></div>


It worked when I open it in a browser(PC). After I upload to phonegap and installed in my phone, it work with not allow my to select the folder, only allow me to select single files.

Thank you.
Photo of JesseMonroy650 (Volunteer)

JesseMonroy650 (Volunteer), Champion

  • 3325 Posts
  • 122 Reply Likes
@Zack,
thanks for your response. Do you have a link for Mr. Tiki? Many tutorials we have reviewed in the past have been incorrect.

On webkitdirectory, this appears to be a javascript library or a browser extension. It may not be available. Phonegap is not a webserver or a webbrowser. If you have a link for this we could assist in debugging your code _and_ give you a definitive answer where it works or not.

Thanks
Jesse
Photo of Zack Hee

Zack Hee

  • 3 Posts
  • 0 Reply Likes
@Jesse,

Here is Mr. Tiki Shabudin website. He didn't show me the <input type="file"></input> before. he just guide me show basic html and javascript.

Beside the webkitdirectory, multiple also does't work in my apps. I have tried without the webkitdirectory.

<input type="file" onchange="readFiles(event)" multiple></input>

In PC in can allow me to select multiple files, but it only allow me to select single file in my apps (in smartphone). Is it same with the webkitdirectory.

Thank you.

Zack
Photo of JesseMonroy650 (Volunteer)

JesseMonroy650 (Volunteer), Champion

  • 3325 Posts
  • 122 Reply Likes
@Zack,
the reason I gave you the link above is for you to read it. The sentence also made clear the point. Here is the sentence again.

Phonegap is not a webserver or a webbrowser.

Please read the link. Then please point me to the tutorial (about webkitdirectory) that you are using to write your code. I don't have time to search for it.

Jesse