I\'m sending a file from client-side to server side using XHR:
$(document).on(\'drop\', function(dropEvent) {
dropEvent.preventDefault();
_.each(dropEven
You can upload file with use of EJSON and normal meteor "methods" this way you will be able to get access to user data because it is visible only inside methods and publish functions on server side
this video tutorial may be a good start
also package CollectionFS provides some upload functionalities. It is now little outdated, but idea stays the same.
By default, your routes are created as client side routes. This means, a link to that route will be handled in the browser vs. making a server request. But you can also create server side routes by providing a where
option to the route. The handler for the server side route exposes the request
, response
, and next
properties of the Connect
object. The syntax has changed a little from 0.5.4 to the dev branch so I'll provide both examples depending on which you're using:
v0.5.4
Router.map(function () {
this.route('upload', {
where: 'server',
handler: function () {
var request = this.request;
var response = this.response;
// do whatever
}
});
});
dev
Router.map(function () {
this.route('upload', {
where: 'server',
action: function () {
var request = this.request;
var response = this.response;
// do whatever
}
});
});
The same people who brought you iron-router also have meteor-file which will do the file transfer for you, or you can use as an example for your own implementation
Meteor Router (now deprecated) has server side routing support:
Meteor.Router.add('/upload', 'POST', function() {
// do stuff
});