Doesn't work with ajax
See original GitHub issueI tried 3 approaches: sending JSON with axios, sending FormData with axios, sending FormData with XHR. None worked. req.file
was undefined, and req.body
was empty.
server
import multer from 'multer';
const upload = multer();
app.post('/api/posts/new', upload.single('image'), function(req, res, next){
console.log(req.file);
console.log(req.body);
res.status(200).json(req.body);
})
I’m using KeystoneJS and serverside rendering React if any of that matters
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:9 (3 by maintainers)
Top Results From Across the Web
jquery ajax function not working - Stack Overflow
When I click on the submit button , my ajax request is not working , it looks as if the control is being...
Read more >AJAX not working without any error message - CodeProject
I am doing an ajax request using PHP and jQuery but it is not working, also there is no error message. How can...
Read more >Ajax sometimes work and sometimes just don't work
I'm trying to just randomly edit the ajax or something that related to it, and im delete cache and refresh again and it...
Read more >Click doesn't work after AJAX load - jQuery - AIO Collective
When I load a website everything works fine until I load new items or replace old once. Ajax still works fine but toggle...
Read more >jquery function not working after ajax call and .load() - Reddit
The problem is that after I delete an item the dropdown gets updated and then if I try to delete another item it's...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Seems like this was a client problem that can be solved by the code linked, happy to reopen if we should change something in Multer