|
项目需要把网上的图片下载下来并保存到手机上,从网上找了串代码,但是没反应,求高人指点
function savePicToPhone(img_url,qcode)
{
if(img_url != "")
{
var url = img_url; // image url
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function (fs) {
var imagePath =fileSystem.root.fullPath +"/newsimg/"+ qcode+".jpg"; // full file path
var fileTransfer = new FileTransfer();
fileTransfer.download(url, imagePath, function (entry) {
console.log(entry.fullPath); // entry is fileEntry object
}, function (error) {
console.log("error");
});
});
}
http://blog.csdn.net/loska/article/details/9417325
|
|