onUploadProgress doesn't work

I am following the React Native course and in part two of the course in the Networking section, I ran into an issue. I am not able to get the upload progress from the backend when uploading a new listing. The post method itself is working correctly. I hope anyone can help me with this.

This is my listings.js file:

import client from “./client”;

const endpoint = “/listings/”;

const getListings = () => client.get(endpoint);

const addListing = (listing) => {
const data = new FormData();
data.append(“title”, listing.title);
data.append(“price”, listing.price);
data.append(“categoryId”, listing.category.value);
data.append(“description”, listing.description);

listing.images.forEach((image, index) =>
data.append(“images”, {
name: “image” + index,
type: “image/jpeg”,
uri: image,
})
);

if (listing.location)
data.append(“location”, JSON.stringify(listing.location));

return client.post(endpoint, data, {
onUploadProgress: (progress) => console.log(progress),
});
};

export default {
addListing,
getListings,
};

1 Like

having the same issue…no Success yet

Having this same issue. Any solution?

Still not solution yet?

Hello all. Having the same issue. But looking at axios docs Request Config | Axios Docs

// `onUploadProgress` allows handling of progress events for uploads
  // browser only
  onUploadProgress: function (progressEvent) {
    // Do whatever you want with the native progress event
  },

It’s not supposed to work. onUploadProgress is for browsers only, so it make sense that it doesn’t work on react-native.

I think that feature is completely deprecated at the moment. Agree @Mosh ?

I have been debugging this issue the whole day and I was not able to fix it. It used to be working.
Does anyone have a fix for it ?