亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

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

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

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

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

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

實(shí)現(xiàn)代碼:

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

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

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

相關(guān)文章

最新評(píng)論