2012-02-29 5 views

答えて

3

代わりにrestlerライブラリを確認してください。私はこの正確な目的のために使用しました。

ここでは、ファイルのPOSTがどのように行われるかを示す例の一部の変更されたコードを示します。

// multipart request sending a file and using https 
rest.post('https://twaud.io/api/v1/upload.json', { 
    multipart: true, 
    data: { 
    'sound[message]': 'hello from restler!', 
    'sound[file]': rest.file('doug-e-fresh_the-show.mp3', null, null, null, 'audio/mpeg') 
    } 
}).on('complete', function(data) { 
    sys.puts(data.audio_url); 
}); 
関連する問題