Ъплоуд форма със снапшот

Knoppix_

Registered
Това ми е индекс-а
Код:
<?php
session_start();
if(isset ($_POST["send"]))
{
    $getname=$_POST["myname"];
    include 'connection.php';
    $idvalue=$_SESSION["myvalue"];
    $sql="update entry set name='$getname' where id='$idvalue'";
    $result=mysqli_query($con,$sql)
            or die("error in query");
    if($result)
    {
        echo "Uploaded $_SESSION[myvalue] re ..... ";
    }
    else
    {
        echo "$_SESSION[myvalue] nahi hua";
    }
}
?>

<form action="<?php echo $_SERVER["PHP_SELF"];?>" method="post">
    <input type="text" name="myname" id="myname">
    <input type="submit" name="send" id="send"><br />
    <input type="text" name="shofior" id="shofior" />
</form>

<script type="text/javascript" src="webcam.js"></script>
<script language="JavaScript">
		document.write( webcam.get_html(320, 240) );
</script>
<form>
		<input type=button value="Configure..." onClick="webcam.configure()">
		  
		<input type=button value="Take Snapshot" onClick="take_snapshot()">
	</form>

<script language="JavaScript">
		document.write( webcam.get_html(320, 240) );
</script>

<script language="JavaScript">
    webcam.set_api_url( 'test.php' );
		webcam.set_quality( 90 ); // JPEG quality (1 - 100)
		webcam.set_shutter_sound( true ); // play shutter click sound
		webcam.set_hook( 'onComplete', 'my_completion_handler' );

		function take_snapshot(){
			// take snapshot and upload to server
			document.getElementById('upload_results').innerHTML = '<h1>Uploading...</h1>';
			webcam.snap();
		}

		function my_completion_handler(msg) {
			// extract URL out of PHP output
			if (msg.match(/(http\:\/\/\S+)/)) {
				// show JPEG image in page
				document.getElementById('upload_results').innerHTML ='<h1>Upload Successful!</h1>';
				// reset camera for another shot
				webcam.reset();
			}
			else {alert("PHP Error: " + msg);
		}
		}
	</script>
<div id="upload_results" style="background-color:#eee;"></div>

Когато добавя да се качва втора стойност, нещата просто спират да работят и не може да се добави полето име т.е не влиза в базата данни
Това е скрипт файла:
Код:
<?php
session_start();
include 'connection.php';
$shofior_ime = $_POST["shofior"];
$name = date('YmdHis');
$newname="images/".$name.".jpg";
$file = file_put_contents( $newname, file_get_contents('php://input') );
if (!$file) {
	print "ERROR: Failed to write data to $filename, check permissions\n";
	exit();
}
else
{
    $sql="Insert into shofiori(images , ime) values('$newname' , '$shofior_ime')";
    $result=mysqli_query($con,$sql)
            or die("Error in query");
    $value=mysqli_insert_id($con);
    $_SESSION["myvalue"]=$value;
}

$url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['REQUEST_URI']) . '/' . $newname;
print "$url\n";

?>
 

Back
Горе