How to upload file to restify service

1,443 views
Skip to first unread message

Huaquan Wang

unread,
Apr 16, 2014, 9:45:29 AM4/16/14
to res...@googlegroups.com
hi All,

is anyone has the simple code about upload files to restify service?
the bellow is my code but not works, can't get the files which is undefined, is there any wrong or missing.
1. on server side, I have a service using restify.
...
server = restify.createServer({
    name: 'Name'
})
server.use(restify.queryParser());
server.use(restify.fullResponse());
server.use(restify.bodyParser());
server.use(restify.CORS());
server.use(restify.jsonp());

server.post( { path: config.prefix_route + '/file/upload' }, function(req, res, next){
    var tempPath = req.files.file.path;
    } );

2. on cilent side, the web is url is http://localhost/index.html.
 <form action="http://localhost:8080/api/file/upload" method="post">
                                        <input id="file"
                                               type="file">
                                        <input type="submit" value="submit" />
                                    </form>

phaninder pasupula

unread,
Dec 22, 2015, 4:19:08 PM12/22/15
to restify
Same here. Restify doesn't support multipart it seems. 
Reply all
Reply to author
Forward
0 new messages