2 years ago

#64011

test-img

Matthieu Benard

Explore .html file input with Javascript

I'm a beginner at Javascript and I would like to build a Web application (html, css and JS). This application allows you to add a .html file (which contains a table with a defined class inside).

I managed to make the input and load it into the Javascript but then I can't get the table into the .HTML file The file seems to be in "blob" format ??? The goal is to display the table in my index.html and then style it.

<p>Depot du fichier d'identification :</p>
<label for="myfile">Select a file:</label>
<input type="file" id="myfile" name="myfile">
<p></p>


<script src="script.js"></script>
// file recuperation (script.js)
const fileInput = document.getElementById('myfile');
fileInput.onchange = () => {
    const selectedFile = fileInput.files[0];
    console.log(selectedFile);
    const table = fileInput.getElementsByClassName("identification");
    console.log(table);
}

Thank you in advance.

javascript

html

offline

0 Answers

Your Answer

Accepted video resources