使用angular-file-upload获取文件内容
Get the content of the file by using angular-file-upload
我创建了一个 input
用于文件上传 angular-file-upload -
<input type="file" nv-file-select="" uploader="uploader" multiple />
我上传了一个示例 json 文件 -
{
name: "Alice"
}
我想在 onAfterAddingFile
活动中看到它的内容 -
onAfterAddingFile function(item) {: Fires after adding a single file to the queue.
uploader.onAfterAddingFile = function (fileItem) {
console.info('onAfterAddingFile', fileItem.formData); // fileItem.formData is []
}
但是 fileItem.formData
只包含 - []
如何获取上传文件的内容?
onAfterAddingFile
- 将文件添加到上传队列后触发。文件本身尚未上传,因此您无法访问任何内容,只能访问元信息。此外,据我了解,formData {Array}: Data to be sent along with this file
表示这是要发送的补充数据,而不是文件数据。
我创建了一个 input
用于文件上传 angular-file-upload -
<input type="file" nv-file-select="" uploader="uploader" multiple />
我上传了一个示例 json 文件 -
{
name: "Alice"
}
我想在 onAfterAddingFile
活动中看到它的内容 -
onAfterAddingFile function(item) {: Fires after adding a single file to the queue.
uploader.onAfterAddingFile = function (fileItem) {
console.info('onAfterAddingFile', fileItem.formData); // fileItem.formData is []
}
但是 fileItem.formData
只包含 - []
如何获取上传文件的内容?
onAfterAddingFile
- 将文件添加到上传队列后触发。文件本身尚未上传,因此您无法访问任何内容,只能访问元信息。此外,据我了解,formData {Array}: Data to be sent along with this file
表示这是要发送的补充数据,而不是文件数据。