I am trying to get the PhoneGap application to create a directory on a mobile device, but I continue to work with the same errors that are a mixture:
ENCODING_ERR - 5 - The URL is invalid. Make sure the URL is complete and valid.
PATH_EXISTS_ERR - 12 - A file or directory with the same path already exists.
INVALID_MODIFICATION_ERR - 9 - The requested modification is not allowed. For example, an application may try to move the directory to its own child or move the file to the parent directory without changing its name.
$( document ).on( 'click', '#A2', function () { downloadPhoto(); } ); function downloadPhoto() { alert( "Downloading" ); window.requestFileSystem( LocalFileSystem.PERSISTENT, 0, function systemSuccess( dirEntry ) { alert( "Download about to begin" ); dirEntry.root.getDirectory( 'thisfilenamewillneverexist', { create: true }, function ( fileSystem ) { alert( fileSystem ); }, errorHandler ); }, errorHandler ); } function errorHandler( e ) { var msg = ''; switch ( e.code ) { case FileError.ENCODING_ERR: msg = 'ENCODING_ERR'; break; case FileError.INVALID_MODIFICATION_ERR: msg = 'INVALID_MODIFICATION_ERR'; break; case FileError.INVALID_STATE_ERR: msg = 'INVALID_STATE_ERR'; break; case FileError.NO_MODIFICATION_ALLOWED_ERR: msg = 'NO_MODIFICATION_ALLOWED_ERR'; break; case FileError.NOT_FOUND_ERR: msg = 'NOT_FOUND_ERR'; break; case FileError.NOT_READABLE_ERR: msg = 'NOT_READABLE_ERR'; break; case FileError.PATH_EXISTS_ERR: msg = 'PATH_EXISTS_ERR'; break; case FileError.QUOTA_EXCEEDED_ERR: msg = 'QUOTA_EXCEEDED_ERR'; break; case FileError.SECURITY_ERR: msg = 'SECURITY_ERR'; break; case FileError.TYPE_MISMATCH_ERR: msg = 'TYPE_MISMATCH_ERR'; break; default: msg = 'Unknown Error'; break; }; alert( 'Error: ' + msg ); }
Why or how does this file name already exist if it is the first time I create it?
source share