phonegap “new FileTransfer” “is not defined”

后端 未结 3 675
挽巷
挽巷 2021-02-14 08:19

I get the following error:

    ReferenceError: FileTransfer is not defined

when i try to create a new instance:

    var ft = ne         


        
相关标签:
3条回答
  • 2021-02-14 08:31

    Please note this plugin doesn't work from the browser, it will throw a “new FileTransfer is not defined” error. Use a real device to test.

    0 讨论(0)
  • 2021-02-14 08:43

    Did you add the 'file' or 'file-transfer' plugin?

    The Filetransfer plugin is a separate plugin, and you need to add both of them:

    cordova plugin add cordova-plugin-file-transfer
    

    Otherwise, the 'FileTransfer' is indeed not defined.

    0 讨论(0)
  • 2021-02-14 08:46

    Run the following commands in your phonegap project. And it should resolve the issue on your next build.

    Access files on device or network (File API):

    $ phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-file.git
    $ phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer.git
    

    See PhoneGap API Documentation - The Command-line Interface for a list of the plugins.

    0 讨论(0)
提交回复
热议问题