Skip to content
Advertisement

Display file name after selecting it

I want to create a button on my site that will allow the user to upload a file from their device (computer, phone).

I have already made this button and it opens a window where you can select a file.

But I ran into a problem: I would like to display the name of this file on the page.

I have this component highlighted in orange:

JavaScript

And in the BoxForChoiceFile component there is a button for choosing a file

JavaScript

Advertisement

Answer

In addition to what Alberto Anderick Jr answered, this is how you can pass the file name from the child component to the father component and show it below SelectFileComponent, in your BoxForChoiceFile :

JavaScript

and in your SelectFileComponent:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement