superagent and multipart/form-data

1,908 views
Skip to first unread message

Angelo Chen

unread,
Sep 17, 2012, 9:15:17 AM9/17/12
to Express
Hi,

I'm trying to use superagent to upload some pdfs to Goodreader,
initial code as follow, not yet reach the file name part:

var request = require('superagent');

request
.post('http://192.168.1.127:8080/My%20Documents/
_______HTMLFORMFILEUPLOADVIAHTTP_______')
.type('multipart/form-data')
.send('foo=bar')
.end(function(res){
console.log(res)
console.log(res.text);
})

seems not so right, the html from Goodreader to upload file is as
follow, any hints on how I can make this work? thanks,

Angelo

<form name="upload" action="_______HTMLFORMFILEUPLOADVIAHTTP_______"
method="POST" enctype="multipart/form-data">
Select file to upload:&nbsp;
<input type="file" name="filename" size="40"
onchange="this.form.submit.style.visibility='visible'">
<input type="submit" name="submit" value="Upload selected file"
style="visibility: hidden">
</form>

tjholowaychuk

unread,
Sep 17, 2012, 6:07:23 PM9/17/12
to Express
Reply all
Reply to author
Forward
0 new messages