I have a HTML form that takes few details from the user along with a picture.
<div id="form_page">
<div id="form_body">
<div id="head">
<h1 id="heading">Candidate registration</h1>
</div>
<br />
<div id="input_name" class="input">
<input id="name" type="text"
Placeholder="Name" name="c_name"
required>
</div>
<div id="input_class" class="input">
<input type="text" placeholder=
"Constituency" name="c_constituency" required>
</div>
<div id="input_year" class="input">
<input id="school" type="text"
name="c_party"
placeholder="Party">
</div>
**<div id="input_year" class="input">
<input id="school" type="file"
name="party_logo" >
</div>**
<div class="id input">
<input id="submit" type="submit"
name="submit" value="submit">
</div>
</div>
</div>
And I'm trying to store this information into a JSON file and I've written the code in NodeJS
var data = {
"name": cname,
"constituency" : cconstituency,
"party": cparty,
}
var data1 = JSON.stringify(data);
fs.writeFile('detail.json',data1, finished);
I'm able to save the data in JSON file but how can I save the image src in the file?