<?php
session_start();
echo getcwd() ;

// new filename
//$filename = 'pic_'.date('YmdHis') . '.jpeg';
$filename = $_SESSION['PIC_FILENAME'];

$url = '';
if( move_uploaded_file($_FILES['webcam']['tmp_name'], getcwd().'/upload/'.$filename) ){
 $url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['REQUEST_URI']) . '/upload/' . $filename;
}

// Return image url
echo $url;

?>