Back End Development and APIs Projects - File Metadata Microservice

last test of File Metadata Microservice not passing . all seams legit. Cant figure it our what is failing

  • test criteria:

When you submit a file, you receive the file name , type , and size in bytes within the JSON response. When you submit a file, you receive the file name , type , and size in bytes within the JSON response.

  • the response I receive to the call is this:

{“name”:“potato 4mb 2.jpg”,“type”:“image/jpeg”,“size”:2398029}

  • te response is created this way:

    // Extract file details
    const data = {
    name: req.file.originalname,
    type: req.file.mimetype,
    size: req.file.size, (says size is on bytes)
    };

  • Full code if needed:

https://freecodecam-boilerplate-xwwur3tpzhj.ws-eu114.gitpod.io/

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36

Challenge Information:

Back End Development and APIs Projects - File Metadata Microservice

I found issue:

API CALL NEEDS TO BE /api/fileanalyse:

  <form enctype="multipart/form-data" method="POST" action="/api/fileanalyse">
    <input id="inputfield" type="file" name="upfile" />
    <input id="button" type="submit" value="Upload" />
  </form>

ALSO IN JS:

app.post(‘/api/fileanalyse’, upload.single(“upfile”), (req, res)=>{

let name = req.file.originalname
let type = req.file.mimetype
let size = req.file.size

res.json({‘name’:name, ‘type’:type,‘size’:size})
});

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.