0

Scenario: I have a simple HTML page as below

<form action="http://example.com/nodejs/endpoint" 
  method="post" 
  enctype="multipart/form-data">
<label>
    Select JSON file
    <input type="file" name="json">
</label>
<input type="submit">

Requirement: Please help me parse the json file selected by the user in my Nodejs application. I have tried all google result. Also i am behind a proxy.So is that a reason for not getting the file ?

The code i tried looks like

    console.log("In json parsing");
var fs=require('fs');
var path=require('path');
fs.readFile(req.files.json.path,function(err,data){
    console.log(data);
});

Please help. Thanks in advance

Jibin TJ
  • 416
  • 1
  • 4
  • 15

0 Answers0