1

I am trying to Upload the file and save the file in the state of the component as file.originFileObj, I want my output to be like while uploading the file the progress should be Shown

for Uploading

And while uploading the file after selection

After

I have used antd upload but it does not provide the round and file size status and that kind of percentage, I have also tried simple HTML input tag but it also does not work, the last thing I got near to the requirement was uploading the file to certain URL and displaying that progress but I need to be saved in my state and uploading status to be shown as shown in the image 2

1 Answer 1

3

add options to your api request

    const options = {
        onUploadProgress: (progressEvent) => {
            const {loaded, total} = progressEvent
            let percent = Math.floor(loaded * 100 / total)
            this.setState({
                uploadPercentage: percent
            })
        },
    }
Sign up to request clarification or add additional context in comments.

1 Comment

As asked there is no API request involved, Just upload a pdf file and store it to the state of Component

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.