problem using getFile with cordova-plugin-file 2.1.0

34 views
Skip to first unread message

gho...@mainstreamdata.com

unread,
Jul 28, 2015, 5:16:29 PM7/28/15
to phonegap
The following works with cordova-plugin-file 1.3.3 ok but when i try with 2.1.0 it doesn't play so nice:- 


                    $window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
                                        
                    function gotFS(fs) {
                        fs.root.getFile("/storage/emulated/0/Tulips.JPG", {create: false}, gotFileEntry, fail);
                    }

                    function gotFileEntry(fileEntry) {
                        console.log("gotFileEntry ok");
                     }
                    
                    function fail(error) {
                        console.log("Failed: " + error.code);
                    }

The log I get is "Failed: 1". Did something change in 2.1.0 to break this?

Jesse Monroy

unread,
Jul 28, 2015, 6:28:40 PM7/28/15
to phonegap, gho...@mainstreamdata.com
@gho,
it is likely you noticed the new MAJOR version number. Things did not break, they changed - this is the reason for a version number change.

It would be good to read the documentation

ErrorCode - Reason
1 - NOT_FOUND_ERR

http://docs.phonegap.com/en/4.0.0/cordova_plugins_pluginapis.md.html#Plugin%20APIs
http://plugins.cordova.io/#/package/org.apache.cordova.file

Jesse

jcesarmobile

unread,
Jul 29, 2015, 2:09:33 AM7/29/15
to phonegap, gho...@mainstreamdata.com, jess...@gmail.com

Jesse Monroy

unread,
Jul 29, 2015, 2:38:15 AM7/29/15
to phonegap, jcesar...@gmail.com
@jcesarmobile,
thanks for the correction.
Jesse

gho...@mainstreamdata.com

unread,
Jul 30, 2015, 2:05:16 AM7/30/15
to phonegap, gho...@mainstreamdata.com
Thanks for the response. It spurred me on to try harder and I've now got resolveLocalFileSystemURL() working  by prependng "file://" onto my "/storage/emulated/0/Tulips.JPG" path. 


Reply all
Reply to author
Forward
0 new messages