search

Home  >  Q&A  >  body text

How can I customize the fetch method to work with the FilePond file uploader?

<p>I encountered a problem when using FilePond's custom <code>fetch</code> method and I didn't know what to do with the <code>load()</code> function. The documentation requires passing the file object to the <code>load()</code> method, but I don't know how to get it. I tried passing <code>null</code> but it throws an error: This is the code: </p> <pre class="brush:php;toolbar:false;">server: { fetch: (url, load, error, progress, abort, headers) => { progress(true, 0, 1024); load(file); return { abort: () => { abort(); }, }; },</pre> <p>Any ideas? </p>
P粉129275658P粉129275658452 days ago655

reply all(1)I'll reply

  • P粉340980243

    P粉3409802432023-09-02 16:18:50

    This is what I do when getting files from the server in my FilePond.

    load: async (source, load, error, progress, abort, headers) => {
                let file = files.find(el => el.file == source)
                var myRequest = new Request(source);
                fetch(myRequest).then(function(response) {
                  response.blob().then(function(myBlob) {
                    load(myBlob);
                  });
                });

    reply
    0
  • Cancelreply