欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

web 開發(fā)之創(chuàng)建本地文件夾的實現(xiàn)方法

 更新時間:2017年08月03日 14:34:46   作者:michael_ouyang  
這篇文章主要介紹了web 開發(fā)之創(chuàng)建本地文件夾的實現(xiàn)方法的相關(guān)資料,filemanage_util.fullPath 就是創(chuàng)建文件的路徑 這是跨平臺的創(chuàng)建文件夾,需要的朋友可以參考下

web 開發(fā)之創(chuàng)建本地文件夾的實現(xiàn)方法

 filemanage_util.fullPath 就是創(chuàng)建文件的路徑

這是跨平臺的創(chuàng)建文件夾,不像Android那樣還要通過 Environment.getExternalStorageDirectory() 的原生代碼來創(chuàng)建

實現(xiàn)代碼:

document.addEventListener("deviceready", onDeviceReady, false);

function onDeviceReady() {
      // alert('ondeviceReady');
      // window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem;
      console.log("文檔中心===========>軟件準備就緒:設(shè)置檢測文件存儲目錄開始.");
      window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function (fileSystem) {
        console.log("文檔中心===========>檢測臨時文件存儲目錄方法");
        //util.appRootDirName 全局變量,這里是zgky
        fileSystem.root.getDirectory(filemanage_util.appRootDirName, {
          create: true,
          exclusive: false
        }, function (entry) {
          //網(wǎng)上流傳的資料中都是使用fullPath,在這里我獲取到的是相對目錄,在下載時使用會報錯,所以換做了toURL()
          //這是一個全局全局變量,用以保存路徑
          console.log("文檔中心===========>創(chuàng)建文件夾成功,正在設(shè)置相關(guān)的參數(shù)!");
          filemanage_util.fullPath = entry.toURL();
          // alert(util.fullPath);
          console.log("文檔中心===========>創(chuàng)建文件夾成功:" + filemanage_util.fullPath);
          //console.log(util.fullPath);
        }, function () {
          console.log("文檔中心===========>創(chuàng)建文件夾失??!");
        });
        console.log("文檔中心===========>檢測臨時文件目錄方法結(jié)束!");
      }, function () {
        console.log("文檔中心===========>創(chuàng)建文件夾失敗");
      });
      console.log("文檔中心===========>軟件準備就緒:設(shè)置檢測文件存儲目錄結(jié)束");
    };

以上就是web創(chuàng)建本地文件夾的實現(xiàn)方法,如有疑問請留言或者到本站社區(qū)交流討論,感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!

相關(guān)文章

最新評論