joltup / rn-fetch-blob

A project committed to making file access and data transfer easier, efficient for React Native developers.
MIT License
2.84k stars 784 forks source link

Upload progress only called once with multipart/form-data #161

Open jgautheron opened 6 years ago

jgautheron commented 6 years ago

I am uploading a file through multipart/form-data and getting only once the uploadProgress event, no matter how I tweak the interval.

"react-native": "~0.55.2",
"rn-fetch-blob": "git://github.com/joltup/rn-fetch-blob.git", // latest, updated just now

Issue previously reported here: https://github.com/wkh237/react-native-fetch-blob/issues/177

nghiatv commented 5 years ago

still has no answer. So sad

AugustoAleGon commented 5 years ago

Same problem

nikolaytsigvintsev commented 5 years ago

Same problem

kevin-carlson commented 4 years ago

Any work arounds or solutions for this?

stharvey commented 2 years ago

Hello I am having the same issue here.

I am using multipart/form-data to upload an image of ~2mb. I am testing on a very slow connection - the upload takes around 2 minutes. No matter what I set the "interval" value to the callback appears to trigger each time at exactly:

written: 10240 written: 81920

Does anyone have any idea how I can access the upload progress more frequently?

await RNFetchBlob.fetch(
          "POST",
          url,
          {
            Authorization: "Bearer access-token",
            "Content-Type": "multipart/form-data",
          },
          formData
        )
          .uploadProgress({ interval: 50 }, (written, total) => {
  console.log(
              "uploaded",
              written,
              total,
              Math.round((written / total) * 100) + "%"
            );
          })
          .then((resp) => {
            console.log("📤 -  Upload Completed");
          })
          .catch((err) => {
            console.log("📤 - Upload error: ", err);
          });