javascript - node.js and express file uploader -


so following tutorial: http://thejackalofjavascript.com/uploading-files-made-fun/

i have followed steps way create routes , haven't created views. says

thats done our server. restart server , navigate http://localhost:3000/upload. should see json response empty array of files.

however when try run app.js sits few seconds , goes command prompt. no errors given , clueless how fix this.

here code in routes/uploadmanager.js

var options = { tmpdir:  __dirname + '/../public/uploaded/tmp', uploaddir: __dirname + '/../public/uploaded/files', uploadurl:  '/uploaded/files/', maxpostsize: 11000000000, // 11 gb minfilesize:  1, maxfilesize:  10000000000, // 10 gb acceptfiletypes:  /.+/i, // files not matched regular expression force download dialog, // prevent executing scripts in context of service domain: inlinefiletypes:  /\.(gif|jpe?g|png)/i, imagetypes:  /\.(gif|jpe?g|png)/i, imageversions: {     width:  80,     height: 80 }, accesscontrol: {     alloworigin: '*',     allowmethods: 'options, head, get, post, put, delete',     allowheaders: 'content-type, content-range, content-disposition' }, storage : {     type : 'local' } };  var uploader = require('blueimp-file-upload-expressjs')(options);  module.exports = function (router) { router.get('/upload', function (req, res) {     uploader.get(req, res, function (obj) {         res.send(json.stringify(obj));     }); });  router.post('/upload', function (req, res) {     uploader.post(req, res, function (obj) {         res.send(json.stringify(obj));     }); });  router.delete('/uploaded/files/:name', function (req, res) {     uploader.delete(req, res, function (obj) {         res.send(json.stringify(obj));     }); }); return router; } 

i apologize. trying run node app.js when supposed running node bin/www since express.js app.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

django - CSRF verification failed. Request aborted. CSRF cookie not set -