1
我已經在回送3一個非常簡單的服務器上運行,並再次遇到這個問題:https://github.com/strongloop/loopback-component-storage/issues/9迴環3環回分量存儲掛在POST文件
由於學家和實例不工作下去我會喜歡重新開放這個問題。 我創建了一個非常簡單的API模板服務器,並添加以下代碼:
module.exports = function (File) {
File.upload = function (ctx, options, cb) {
if (!options) options = {};
ctx.req.params.container = 'common';
console.log("DO");
File.app.models.Storage.upload(ctx.req, ctx.result, options, function (err, fileObj) {
console.log("FILE");
cb(fileObj);
});
};
File.remoteMethod(
'upload',
{
description: 'Uploads a file',
accepts: [
{arg: 'ctx', type: 'object', http: {source: 'context'}},
{arg: 'options', type: 'object', http: {source: 'query'}}
],
returns: {
arg: 'fileObject', type: 'object', root: true
},
http: {verb: 'post'}
}
);
};
現在的問題是,儘管通過郵差張貼到上傳的功能,我在控制檯看到以下行爲:
DO
Error: Request aborted
at IncomingMessage.<anonymous> (...../server/node_modules/formidable/lib/incoming_form.js:120:19)
at emitNone (events.js:86:13)
at IncomingMessage.emit (events.js:188:7)
at abortIncoming (_http_server.js:383:9)
at socketOnClose (_http_server.js:377:3)
at emitOne (events.js:101:20)
at Socket.emit (events.js:191:7)
at TCP._handle.close [as _onclose] (net.js:504:12)
FILE
和送信返回一個空的響應...
我完全失去了在這裏當初學者在這一步!
這是我的錯嗎?
THX對於任何輸入
我現在還提交了一個錯誤...也許有人在IBM會修復此問題:https://github.com/strongloop/loopback-component-storage/issues/196 – PArt
你提交郵遞員的文件輸入?作爲二進制或表單數據?你能展示一個輸入的例子嗎? –