Implementation of creating local folders in web development: web Development
How to create a local folder in web Development
Filemanage_util.fullPath is the path of the file to be created.
This is a cross-platform creation folder. Unlike Android, you need to use native code of Environment. getExternalStorageDirectory () to create a folder.
Implementation Code:
Document. addEventListener ("deviceready", onDeviceReady, false); function onDeviceReady () {// alert ('ondeviceready'); // window. requestFileSystem = window. requestFileSystem | window. webkitRequestFileSystem; console. log ("Documentation Center ==========> software ready: Set the detection file storage directory to start. "); window. requestFileSystem (LocalFileSystem. PERSISTENT, 0, function (fileSystem) {console. log ("document center ==========> detect the temporary file storage directory method"); // util. appRootDi RName global variable. Here is zgky fileSystem. root. getDirectory (filemanage_util.appRootDirName, {create: true, exclusive: false}, function (entry) {// fullPath is used in all the materials circulating on the Internet. Here I get the relative directory, when downloading, an error is reported. Therefore, toURL () // is a global variable used to save the console path. log ("document center ==========> the folder is created successfully and relevant parameters are being set! "); Filemanage_util.fullPath = entry. toURL (); // alert (util. fullPath); console. log ("document center ==========> folder created successfully:" + filemanage_util.fullPath); // console. log (util. fullPath) ;}, function () {console. log ("document center ==========> failed to create a folder! ") ;}); Console. log (" document center ============> the method for detecting the temporary file directory is complete! ") ;}, Function () {console. log ("document center ==========> failed to create a folder") ;}); console. log ("Documentation Center ==========> software ready: Set the detection file storage directory to end ");};
The above is the implementation method for creating local folders on the web. If you have any questions, please leave a message or go to the community on this site for discussion. Thank you for reading this article and hope to help you. Thank you for your support for this site!