How to open SDCARD of android using phonegap

后端 未结 2 448
无人及你
无人及你 2020-12-07 04:57

Hi all i was trying to upload a pdf file to my php server script i pdf file is there on android mobile it will be on sd card only so i want to open sd card of android device

2条回答
  •  忘掉有多难
    2020-12-07 05:40

    U can easily do that its very easy
    
        window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onFileSystemSuccessUpload, fail);
    
        function onFileSystemSuccessUpload(fileSystem) {
         // get directory entry through root and access all the folders
                 var directoryReader = fileSystem.root.createReader();
    
        // Get a list of all the entries in the directory
        directoryReader.readEntries(successReader,fail); 
    
              }
    
          function successReader(entries) {
            var i;
            for (i=0; i
                                                            
提交回复
热议问题