colloqi / pisignage-server

Local Server to manage piSignage players based on node.js
http://www.pisignage.com
MIT License
372 stars 153 forks source link

(api) Error: Unexpected field when post file to /api/files #27

Closed janwout closed 8 years ago

janwout commented 8 years ago

I installed pignage local, i run into the following error: When i post a file to /api/files i see the error below. I have an basic authentication header and form-data withe type file and a file.

Error: Unexpected field at makeError (/home/vagrant/pisignage-server/node_modules/multer/lib/make-error.js:12:13) at wrappedFileFilter (/home/vagrant/pisignage-server/node_modules/multer/index.js:39:19) at Busboy. (/home/vagrant/pisignage-server/node_modules/multer/lib/make-middleware.js:112:7) at Busboy.emit (events.js:106:17) at Busboy.emit (/home/vagrant/pisignage-server/node_modules/multer/node_modules/busboy/lib/main.js:31:35) at PartStream. (/home/vagrant/pisignage-server/node_modules/multer/node_modules/busboy/lib/types/multipart.js:213:13) at PartStream.emit (events.js:95:17) at HeaderParser. (/home/vagrant/pisignage-server/node_modules/multer/node_modules/busboy/node_modules/dicer/lib/Dicer.js:51:16) at HeaderParser.emit (events.js:95:17) at HeaderParser._finish (/home/vagrant/pisignage-server/node_modules/multer/node_modules/busboy/node_modules/dicer/lib/HeaderParser.js:68:8) at SBMH. (/home/vagrant/pisignage-server/node_modules/multer/node_modules/busboy/node_modules/dicer/lib/HeaderParser.js:40:12) at SBMH.emit (events.js:106:17) at SBMH._sbmh_feed (/home/vagrant/pisignage-server/node_modules/multer/node_modules/busboy/node_modules/dicer/node_modules/streamsearch/lib/sbmh.js:159:14) at SBMH.push (/home/vagrant/pisignage-server/node_modules/multer/node_modules/busboy/node_modules/dicer/node_modules/streamsearch/lib/sbmh.js:56:14) at HeaderParser.push (/home/vagrant/pisignage-server/node_modules/multer/node_modules/busboy/node_modules/dicer/lib/HeaderParser.js:46:19) at Dicer._oninfo (/home/vagrant/pisignage-server/node_modules/multer/node_modules/busboy/node_modules/dicer/lib/Dicer.js:197:25)

janwout commented 8 years ago

The same call on https://pisignage.com/api/files with postman, works

janwout commented 8 years ago

version is 1.7.5

navaneetharaopy commented 8 years ago

Hi,

1) Check the method,api end point and authorization header method : POST api: /api/files and authorization header is base64 converted username and password (standard http auth username:password)

2) Check number of files uploaded , The max allowed is 10 files

3) Check line 77 in public/app/js/directives/pi.js , Routine for sending files is available in this file.

janwout commented 8 years ago

1) I checked 2) I am trying to upload 1 file, see below. 3) thanks, but it does not give me a clue yet. {'0_event.html': "blaaaaaa"} What worries me is that the api/files on pisignage.com works en my local server not (what is the difference?)

navaneetharaopy commented 8 years ago

Hi, If you have a input file element like <input type="file" > , Just add name="assets" attribute to input element, like < input name="assets" type="file" />

If you check the source code the file upload is handled by multer, Multer is configured to look for "assets" key in file upload object (line no. 28, pisignage-server/config/routes.js)

janwout commented 8 years ago

This works, thank you