【发布时间】:2015-01-28 19:26:03
【问题描述】:
我正在尝试使用 Dropzone.js 重新创建已删除文件/文件夹的文件夹结构。 有没有办法可以访问每个文件的完整路径,以便在php端重新创建目录结构?
【问题讨论】:
标签: dropzone.js
我正在尝试使用 Dropzone.js 重新创建已删除文件/文件夹的文件夹结构。 有没有办法可以访问每个文件的完整路径,以便在php端重新创建目录结构?
【问题讨论】:
标签: dropzone.js
这是一种简单的方法,您可以另外发送某些文件夹中所有文件的完整路径:
dropzone.on("sending", function(file, xhr, data) {
// if file is actually a folder
if(file.fullPath){
data.append("fullPath", file.fullPath);
}
});
【讨论】:
你可以使用文件阅读器,我是在 Angular 5 中完成的:
onFilesAdded(files: File[]) {
console.log(files);
this.dropzone.reset();
files.forEach(file => {
const reader = new FileReader();
let content;
reader.onload = (e: ProgressEvent) => {
content = (e.target as FileReader).result;
console.log(content);
};
this.previewImage(file).then(response => {
const imageItem = new FileItem(
response,
content,
);
let imagesComponentItems = this.store.value.imagesComponentItems;
imagesComponentItems = [...imagesComponentItems, imageItem];
this.store.set("imagesComponentItems", imagesComponentItems);
this.hasImages();
});
});
}
【讨论】: