Skip to content

SyntaxError: Unexpected token =  #50

@xman51

Description

@xman51

I am unable to run my application with express-fileupload installed. I get the following error when attempting to run my application:

/node_modules/express-fileupload/lib/index.js:137
mv: function(path, callback = null) {
^

SyntaxError: Unexpected token =
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (/.js:10:16)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)

Here is my route code:

app.post("/admin/hoverimage/upload/:id", function(req, res){
			if (!req.files)
    	return res.status(400).send("No files were uploaded.");
			console.log(req.body);
			// The name of the input field (i.e. "sampleFile") is used to retrieve the uploaded file
  		let hoverimage = req.files.hoverimage;
			let path = "/media/"+hoverimage.name;
			hoverimage.mv(path, function(err) {
				if (err)
					return res.status(500).send(err);
				res.send("File uploaded!");
			});
			//res.redirect("/admin/gallery/images/"+id);
		});

Please advise.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions