I am working with Filepond to upload images asynchronously and have an update page to retrieve the already uploaded files. Now to retrieve a file already uploaded, we have to configure the file property and have to pass server file reference. Now my question is on load function of the server property I want to change the name of the server file reference with the name of the file. As in, on the update page I am loading the already uploaded image and want to change the source option with the filename of the file being loaded, so that on the update I can check if this is a new file or not.
Here is my pond
$("#ios-icon-pond").filepond({
...common_icon_properties,
name: "app_submission_form[ios_app_icon]",
className: "ios_icon_pond",
labelFileProcessingError: (response) => {
return serverResponse.message;
},
labelFileLoadError: (response) => {
return serverResponse;
},
files: is_ios_new_record
? null
: [
{
// the server file reference
source: "ios_app_icon",
// set type to local to indicate an already uploaded file
options: {
type: "local",
},
},
],
server: {
process: {
url: "/app_submission_form_uploads",
method: "POST",
headers: {
"X-Form-Type": "ios",
"X-Image-Type": "ios_app_icon",
"X-CSRF-Token": $('meta[name="csrf-token"]').attr("content"),
},
onerror: (response) => {
serverResponse = JSON.parse(response);
},
},
load: is_ios_new_record
? null
: {
url: "/app_submission_form_uploads",
method: "get",
headers: {
"X-Image-Type": "ios_app_icon",
"X-CSRF-Token": $('meta[name="csrf-token"]').attr("content"),
},
onerror: (response) => {
serverResponse = "File not found";
},
// onload: (response) => {
// // debugger;
// },
},
revert: null,
fetch: null,
},
});
In the above code, we have the server configuration, and it have a load property. What I want it on load, I want to change the source property(Server File reference) of the files object with the filename being loaded.