-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Read Text File: File Error Code 1 #2
Comments
You mentioned you copied it into a new project, did you modify the JS code at all? |
Yes, I used all of your code. |
Hmm. Can you share a Dropbox link to the project? I'll take a look, but if the www folder is the exact same as mine, then I'm not sure what to suggest. Did you test on a device or in the Android emulator? |
I tried in both: emulator (Android 4.4.2) and device (Nexus 5 Android 4.4.4). Cordova version 3.5.0-0.2.6 https://dl.dropboxusercontent.com/u/18204615/testReadlFile.tar.gz Is a strange behavior... |
I can confirm - fails on Android. :( |
Ok, I'm at a loss. I'm going to dig around a bit. |
Ok, this looks to be an Android bug. :( https://issues.apache.org/jira/browse/CB-7273 I'm sorry I never tested this (although I thought I did) - I must have assumed it was so simple that I couldn't imagine it not working. |
This bug got just a minor priority. Is there any other reliable method to read text (JSON) files from the application directory? (This is a requirement for an offline app.) |
XHR? |
XHR for local file system? That's new to me. What I'm looking for is loading JSON files which are installed with the app on the device, in a directory such as www/json/ . |
BTW, a reliable way to do that was using RequireJS, however, since cordova version 3.5.0 there seem to be again conflicts when using booth API's together. |
By XHR I just mean Ajax. If you look at the source code in the demo, I On Fri, Aug 15, 2014 at 11:15 PM, bardu [email protected] wrote:
Raymond Camden, Web Developer for Adobe Email : [email protected] |
If anyone is still searching, this is a working solution for files in www/ (or www/videos/ respectively). var myFilename = "testvid.webm";
var myUrl = cordova.file.applicationDirectory + "www/videos/" + myFilename;
var fileTransfer = new FileTransfer();
var filePath = cordova.file.dataDirectory + myFilename;
var allowFromAll = false;
fileTransfer.download(encodeURI(myUrl), filePath, (function(entry) {
/*
res = "download complete:\n"
res += "fullPath: " + entry.fullPath + "\n"
res += "localURL: " + entry.localURL + "\n"
alert(res += "nativeURL: " + entry.nativeURL + "\n")
*/
var vid = document.getElementById("someID");
vid.src = entry.nativeURL;
angular.element(v).loop = true;
}), (function(error) {
alert("Video download error: source " + error.source);
alert("Video download error: target " + error.target);
}), allowFromAll, {
headers: {
Authorization: "Basic dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA=="
}
}); (try to set allowFromAll to true if it does not work for you.) |
Hi,
I just copy your code into a new cordova project after add android plataform and file plugin, then I get:
FileError
code 1
"1" is File not found
The text was updated successfully, but these errors were encountered: