     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')

    path: "/segment_ts/?callback_url=#{encodeURIComponent(callback_url)}"
    method: 'POST'


  console.log "sending file at path #{path} to:"
  console.log post_options
  post_request = http.request post_options, (res) ->
    if callback? then callback()

  # Pipe file into the post request
  fs.createReadStream(path).pipe post_request


module.exports = (app) ->

  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'
