我的应用程序的服务器端javascript位于名为"server.js"的文件中.如果有人在浏览器中运行[app-name] .rhcloud.com/server.js,他将能够读取文件中的所有信息.那么,我们如何防止此文件被公开?其中有一些信息不能公开,比如MySQL数据库的密码等.
我创建了一个简单的cordova android应用程序,我试图从一个URL下载一个图像到图片库,但我真的不知道出了什么问题。我已经在 stackoverflow 中搜索了很多,包括以下链接:
如何使用Phonegap将Image对象保存到Android中的文件中?
我已经安装了cordova File Transfer插件并尝试从官方网站上做示例,但它也不起作用:https : //cordova.apache.org/docs/en/latest/reference/cordova-plugin-file-转移/
我尝试了 2 种不同的代码,它们是:
1)第一次尝试:
document.getElementById("myBtn").addEventListener("click", function () {
download("http://cordova.apache.org/static/img/cordova_bot.png", "data", "new_file");
});
function download(URL, Folder_Name, File_Name) {
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, fileSystemSuccess, fileSystemFail);
function fileSystemSuccess(fileSystem) {
var download_link = encodeURI(URL);
ext = download_link.substr(download_link.lastIndexOf('.') + 1); //Get extension of URL
var directoryEntry = fileSystem.root; // to get root path of directory
directoryEntry.getDirectory(Folder_Name, {
create: true,
exclusive: false
}, onDirectorySuccess, onDirectoryFail); // creating folder in sdcard
var rootdir …Run Code Online (Sandbox Code Playgroud)