How can i capture image and save it to the server?

Hi, i have an ongoing project something like this, same concept, upload image and the template sits above the uploaded image then save to the server. The problem is it only saves the template and without the uploaded image. So how can i save the template with the uploaded image? something like a screenshot on a specified width and height? If theres a tutorial for this kindly guide me since im new at actionscript. Im still exploring actionscript specially as3.

var jpgSource:BitmapData = new BitmapData (container_mc.width , container_mc.height);

var jpgEncoder:JPGEncoder = new JPGEncoder(85);
var jpgStream:ByteArray = jpgEncoder.encode(jpgSource);

Save.addEventListener(MouseEvent.CLICK, save);
function save ($event:MouseEvent) {
var header:URLRequestHeader = new URLRequestHeader("Content-type", "application/octet-stream");
var jpgURLRequest:URLRequest = new URLRequest("jpg_encoder_download.php?name=sketch.jpg");
jpgURLRequest.method = URLRequestMethod.POST; = jpgStream;
navigateToURL(jpgURLRequest, "_blank");

// listen to button
image_button.addEventListener (MouseEvent.MOUSE_DOWN, load_image);

// load image
function load_image(event:Event):void
    var imageLoader:Loader = new Loader;
    imageLoader.load (new URLRequest(image_string.text));
    imageLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, imageLoaded);

// load image
function imageLoaded(event:Event):void

image_mc is the container for the uploaded image since i want to edit the image then save the image with the template as my border or something like a picture frame (container_mc). Yeah i know you’ve seen this code in some tutorial, i just want to tweak it so that i can learn to manipulate the actionscript. Hope you guys can help