Skip to content
Snippets Groups Projects
Commit c86f21e6 authored by Jure's avatar Jure
Browse files

File upload is working. Also, celebrations! Repositories are open!

parent d6318854
No related branches found
No related tags found
No related merge requests found
......@@ -21,7 +21,9 @@ export default class EditorWrapper extends React.Component {
fetch('/api/upload', { method: 'POST', body: form })
.then(function (res) {
return callback(null, null)
return res.text()
}).then(function (text) {
return callback(null, text)
})
}
render () {
......
......@@ -163,7 +163,8 @@ var upload = multer({
limits: {fileSize: 1000000, files: 1}
})
api.post('/upload', upload.single('file'), function (req, res, next) {
return req.file.path
console.log(req.file)
return res.send(req.file.path.replace(/^public/, ''))
})
module.exports = api
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment