我对this one提出了类似的问题。如何将此上传到我的RackSpace适配器?
以下是代码:
upload: function(req, res){
var RackspaceAdapter = require('../adapters/rackspace/index'),
receiver = RackspaceAdapter.receive({
username: sails.config.rackspace.username,
apiKey: sails.config.rackspace.apiKey,
region: sails.config.rackspace.region,
container: sails.config.rackspace.container
});
req.file('file').upload(function (err, uploadedFiles) {
if (err) return res.send(500, err);
for(u in uploadedFiles){
gm(uploadedFiles[u]).resize('500','','^').gravity('Center').crop('500','500').stream().pipe(receiver);
}
return res.json({
message: uploadedFiles.length + ' file(s) uploaded successfully!',
files: uploadedFiles
});
});
},