-
-
Notifications
You must be signed in to change notification settings - Fork 89
Closed
Description
Hi, after uploading, I need to update the url property in the fileRecord object, in order to store in my database the fileRecord with all the information needed to see the files later (as commented in the section "Demo 1. Preloading Existing Files" of the documentation).
I try to modify the fileRecord object in this way:
uploaded(ev) {
var files = Array.isArray(ev) ? ev : [ev]
for (var file of files) {
var respObj = JSON.parse(file.request.response)
var backendResponse = respObj.result.files.file[0] //this is the way my backend returns it
if (fileObj) {
file.fileRecord.url = backendResponse.url
}
}
},
The problem is that after modifying the fileRecord, it's not reflected in the v-model instance (the files have no url set)
I even tried to make something more complex: finding the specific file in the model and updating it manually... but it still doesn't work:
uploaded(ev) {
var files = Array.isArray(ev) ? ev : [ev]
for (var file of files) {
var respObj = JSON.parse(file.request.response)
var backendResponse = respObj.result.files.file[0]
var fileRecord = this.fileRecords.find(
f => f.upload.data.result.files.file[0].name === backendResponse.name
)
if (fileRecord) {
fileRecord.url =backendResponse.url
}
}
},
What is the common way of resolving this?
Metadata
Metadata
Assignees
Labels
No labels