     livestream_id = req.params.id
     ls = livestream.getLivestream(livestream_id)
 
-    req.form.complete (err,fields,files) ->
-      if err
-        res.end err
-      else
-        # Forward along the file to the segmenter app
-        sendFileToSegmenter files.segment.path, ->
-          res.end "ok"
+    # Use the stream of the body data to send to the segmenter service
+    sendFileToSegmenter req, ->
+      res.end "ok"
 
   app.post '/internal/add_segment', (req,res) ->
     stream_id = req.param('stream')

    destdir = "#{__dirname}/../public/segmented/"
    filename = "#{stream_id}-#{Math.floor(Math.random()*1000000)}.ts"
    dest = destdir + filename

    # Write out the file
    console.log 'pipe'
    console.log 'endpipe'
    console.log dest
    f = fs.createWriteStream dest
    f.on 'close', ->
      console.log "Wrote file #{dest}"

      # Add link to the live stream
      url = "/segmented/#{filename}"
      ls.addTs url

      # Close the stream
      res.end 'ok'


    # Write out file
    req.pipe(f)


  res.end JSON.stringify {error: {message: message}}


sendFileToSegmenter = (stream,callback) ->
  callback_url = "http://192.168.201.196:3000/internal/add_segment"
  post_options = 
    host: 'vbox'
