|
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>jQuery Mobile Web 应用程序</title>
- <link href="../jquery.mobile-1.3.2.css" rel="stylesheet" type="text/css"/>
- <script src="../jquery.js" type="text/javascript"></script>
- <script src="../jquery.mobile-1.3.2.js" type="text/javascript"></script>
- <script src="../cordova.js" type="text/javascript"></script>
- <script type="text/javascript" charset="utf-8">
- // Wait for device API libraries to load
-
- //
- document.addEventListener("deviceready", onDeviceReady, false);
- // device APIs are available
- //
- function onDeviceReady() {
- var fileTransfer = new FileTransfer();
- //远程的地址
- var uri = encodeURI("http://www.57lehuo.com/upload_test/pdf.pdf");
-
- //加载条显示
-
- fileTransfer.download(
- uri,
- "/mnt/sdcard/pdf_142.pdf", //本地的地址 以及文件名称
- function(entry) {
- alert("download complete: " + entry.fullPath);
-
- //加载条隐藏
- },
- function(error) {
- alert('下载失败');
- console.log("download error source " + error.source);
- console.log("download error target " + error.target);
- console.log("upload error code" + error.code);
- },
- false,
- {
- headers: {
- "Authorization": "Basic dGVzdHVzZXJuYW1lOnRlc3RwYXNzd29yZA=="
- }
- }
- );
-
- //加载条隐藏
-
- }
- </script>
- </head>
- <body>
- 文件上传的例子
- </body>
- </html>
- <p></p>
复制代码
|
|