如何在 Bootstrap-Vue 中检索输入类型文件(包含多个文件)中的文件路径

How to retrieve path of file in input type file (with multiple files) in Bootstrap-Vue

我正在尝试构建一个可以上传多张图片的表单。在我的 JSON 对象中,我需要在进行输入选择时获取图像的路径。 在 bootstrap-vue 中,您可以获得 file.name image.png 图像名称,但我需要像 C:\YourFileSyste\image.png 这样的完整路径 我如何检索它,或者如果它无法检索则追加它。

我一直在关注官方文档 https://bootstrap-vue.js.org/docs/components/form-file/#form-file-input

(另外在旁注中,我可以限制使用 bootstrap-vue 上传的最大文件数。)

或者我以前尝试创建一个自定义句柄事件,但我似乎无法访问每个文件的事件并将其保存在我的 json

handleFileChange(evt){
        console.log(evt.target.files);
        for(var i in evt.target.files)
        {
        this.infoModal.case.images.push({ //infoModal.case.images is the array where images are stored
              id:0,
              name:null,
              url: evt.target.files[i].name
              });
        }
        console.log(this.infoModal.case.images);

      }

出于安全原因,类型文件 (<input type="file">) 的输入不会 return 文件相对于客户端(浏览器)文件系统的完整路径。 <b-form-file> 只是对本机文件输入的包装。

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#Value

注意:BootstrapVue 的文件输入 return 是文件对象(或文件对象数组)而不是文件名(因为本机文件输入 return 只是文件名)。 File 对象具有相同的限制,即仅 return 相对路径(或根本没有路径)。