Created
October 25, 2017 09:42
-
-
Save madeinfree/9b9c92ae499ac13a06588075becc11ca to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app.post('/audio-upload', (req, res) => { | |
| var form = new formidable.IncomingForm(); | |
| form.uploadDir = './audio'; //set upload directory | |
| form.keepExtensions = true; | |
| form.type = true; | |
| form.parse(req, function(err, fields, files) { | |
| console.log(files); | |
| }); | |
| form.on('file', function(field, file) { | |
| require('fs').rename( | |
| file.path, | |
| require('path').join(form.uploadDir, 'myAudio.ogg') | |
| ); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment