-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
When the server is writing the file to disk, the file name generated is referencing a post var that doesn't exist:
Team6Repo/Backend/routes/fooditem.js
Line 14 in d4df01c
| cb(null, req.body.chefname + "_" + req.body.foodname + req.body._id + "." + file.mimetype.substring(6,file.mimetype.length)); |
req.body._id is not set in food-upload.component.js:
Team6Repo/src/components/food-upload.component.js
Lines 85 to 94 in d4df01c
| const newFoodItem = new FormData(); | |
| newFoodItem.append("chefname",this.state.chefname); | |
| newFoodItem.append("price",this.state.price); | |
| newFoodItem.append("foodname",this.state.foodname); | |
| newFoodItem.append("productImage",this.state.productImage,this.state.productImage.name); | |
| newFoodItem.append("description",this.state.description); | |
| newFoodItem.append("ethnicity",this.state.ethnicity); | |
| console.log(newFoodItem); | |
| axios.post('http://localhost:5000/fooditems/add', newFoodItem).then(res => { | |
| console.log(res.data)}); |
This is leading to all uploads having undefined appended to their names
Metadata
Metadata
Assignees
Labels
No labels