【发布时间】:2020-09-08 14:09:46
【问题描述】:
我正在使用 Filepond,这是一个非常棒的插件,但是当我尝试在同一页面上放置多个实例时,只有最后一个实例可以正确上传。所有其他文件都正确显示,但只上传到“tmp”文件夹:文件永远不会进入“uploads”文件夹。
我使用的代码如下,实际上是在之前的 SO 问题中找到的(唯一的区别是我最后的“定义服务器位置”): How do I set up multiple FilePond file input elements on the same page?
这里是:
<input type="file" class="filepond">
<input type="file" class="filepond">
<input type="file" class="filepond">
<script>
// get a collection of elements with class filepond
const inputElements = document.querySelectorAll('input.filepond');
// loop over input elements
Array.from(inputElements).forEach(inputElement => {
// create a FilePond instance at the input element location
FilePond.create(inputElement);
// define the server location
FilePond.setOptions({
server: 'http://localhost:8080/wp12-fidusalaire/wp-content/plugins/one-shot-form/',
});
})
</script>
非常感谢!
【问题讨论】:
标签: javascript upload filepond