Skip to content Skip to sidebar Skip to footer

Js: Submit Html File And Place File Code Within Div

Basically what im looking for is a way for the user to upload an html file when they click button. When the user selects an HTML file, I want to take the

Solution 1:

Using javascript You cannot browse on a clients disk files. However your case is possible. Please check the below stackover question which exactly matches your requirement. Refer Paolo Moretti answer. Here is the link: How to open a local disk file with Javascript?

As you want to browse/upload only HTML files add "accept" to your input file type like this:

<inputtype="file" accept="text/html"/>

In HTML5 you can use file extensions as the accept like this:

<inputtype="file" accept=".html"/>

Post a Comment for "Js: Submit Html File And Place File Code Within Div"