我有一个与此类似的问题。我怎样才能将此上传到我的 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
});
});
},