【发布时间】:2013-12-30 18:55:28
【问题描述】:
我在 WinJS 中构建了一个 Metro 应用程序,它在我的硬盘驱动器的临时文件夹中创建了一个图像 (C:\users\temp...)
但我想将我的图片移动到另一个目录,我该怎么做? 提前感谢您的支持
我也想知道如何使用 WinJS 或 Javascript 删除它们
感谢支持
代码
function imageCapture() {
//Invoke the camera capture UI for snapping a photo
var captureUI = new _capture.CameraCaptureUI();
captureUI.photoSettings.format = _capture.CameraCaptureUIPhotoFormat.jpeg;
captureUI.captureFileAsync(_capture.CameraCaptureUIMode.photo)
.then(function (capturedItem) {
if (capturedItem) {
console.log("image path: " + capturedItem.path);
//Creates the photo
var photoBlobUrl = URL.createObjectURL(capturedItem, { oneTimeOnly: true });
}
});
}
【问题讨论】:
-
你试过什么?你能显示你卡住的代码吗?没有 Manifest 中请求的特定应用程序权限,您不能随意访问 WinRT 中的文件夹:msdn.microsoft.com/en-us/library/windows/apps/hh967755.aspx
-
我用图像创建更新了代码,这会将图片存储在 --- C:\Users\myUser\AppData\Local\Packages\9e8dbb07-5b53-4c61-b7c3-3837d07b6210_jxw2p3as84a1r\TempState\ imagenxxxx.jpg,我尚未在清单上启用 Documents/Music/Video 库文件夹,但它仍在工作
标签: javascript file visual-studio-2012 winjs