pqina / react-filepond

🔌 A handy FilePond adapter component for React
https://pqina.nl/filepond
MIT License
1.87k stars 91 forks source link

[Bug] The server config load is not working properly #211

Closed zmm2tysu closed 2 years ago

zmm2tysu commented 2 years ago

Is there an existing issue for this?

Have you updated React FilePond, FilePond, and all plugins?

Describe the bug

<FilePond
  files={value}
  onupdatefiles={(_files) => {
    setValue(_files);
    setTouched(name);
  }}
  maxFiles={maxCount}
  name="files"
  acceptedFileTypes={accept}
  allowMultiple
  credits={false}
  upload="false"
  oninit={() => setValue(initialValue.map((f) => ({ source: f, options: { type: "limbo" } })))}
  server={{
    // url: ossEndPoint
    load: async (source, load) => {
      console.log("load");
      const file = await getImageFileFromUrl(source);
      load(file);
    },
    // process: (fieldName, file, metadata, load, error, progress, abort) => {
    //   common
    //     .getUploadToken({ prefix })
    //     .then(({ code, data: res }) => {
    //       if (code !== 1) {
    //         abort();
    //         return;
    //       }
    //       ossClient
    //         .upload({
    //           file,
    //           host: res.host,
    //           dirName: prefix,
    //           signature: res.signature,
    //           accessId: res.accessid,
    //           policy: res.policy,
    //           selfName: false,
    //           limitSize: 1024 * 1024,
    //         })
    //         .then((uploadRes) => load(uploadRes.data))
    //         .catch(() => abort());
    //     })
    //     .catch(() => abort());
    // },
  }}
  labelIdle='Drag & Drop your files or <span class="filepond--label-action">Browse</span>'
/>

The above is my code, I found load is not excuted. Also I also found a request for image url, I just need the part of what after the equal sign.

image

Reproduction

My application scenario is I want to edit a file which is uploaded to third-party cloud service that have complete fully domain. I first use server > fetch config, it can woks well, but when I note off the process part, it will upload twice when I edit the file. could any body provide some complete demo or docs?

Environment

- Device: mbp(2019 16inch)
- OS:MacOS Big Sur
- Broser: Chrome latest
- React version: 17.0.2
zmm2tysu commented 2 years ago
image
rikschennink commented 2 years ago

Your issue can be classified as an integration question or a question about specific features of FilePond we ask you kindly to submit it on Stack Overflow.

zmm2tysu commented 2 years ago

@rikschennink why load is not work