Skip to content

Instantly share code, notes, and snippets.

@aredridel
Created December 19, 2010 04:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aredridel/747099 to your computer and use it in GitHub Desktop.
Save aredridel/747099 to your computer and use it in GitHub Desktop.
Form file upload
var http = require('http')
var cl = http.createClient(80, 'dinhe.net');
var req = cl.request('POST', '/~aredridel/t.php',
{ host: 'dinhe.net', 'Content-Type': 'multipart/form-data; boundary=----asd123' })
req.write('------asd123\r\nContent-Disposition: form-data; name="file"; filename="test.txt"\r\nContent-Type: application/octet-stream\r\n\r\n')
req.write("Testing 123\r\n")
req.write("------asd123--r\n")
req.end()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment