Search code examples
filepond

Set hidden input field value after FilePond fetch


I am using FilePond's fetch route to upload a file. After dragging and dropping an image from web, the file URL is successfully sent to the server. I can process and return the response header the way it mentioned in the documentation.

return Response::make('', 200, [
    'Access-Control-Expose-Headers' => 'Content-Disposition, Content-Length, X-Content-Transfer-Id',
    'Content-Type' => mime_content_type($path),
    'Content-Length' => filesize($path),
    'Content-Disposition' => 'inline; filename="' . $uniqueId . '"',
    'X-Content-Transfer-Id' => $uniqueId
]);

After successful upload, filepond generates the hidden input field with the image URL as value.

<fieldset class="filepond--data">
  <input type="hidden" name="avatar" value="https://www.somesite.xyz/logo.png">
</fieldset>

My question is, shouldn't it be updating the hidden field value with the response header X-Content-Transfer-Id's unique value? If not, is there any way I can set the hidden input value to be content from the header so that when I submit the actual form, I get some information related to the temporary file in my server.


Solution

  • This issue is fixed now with the release of filepond version 4.27.2. Here is the detailed discussion - Issue #714