var mat = '<?php echo $matricule; ?>'; var cam = '<?php echo $cam; ?>'; var id ='<?php echo $id; ?>'; var url = 'upload.php?cam='+cam+'&mat='+mat+'&id='+id; // The upload script console.log(url); // affichage dans la console webcam.set_api_url(url);
var url = 'upload.php?cam='+cam+'&mat='+mat+'&id='+id; // The upload script console.log(url); // affichage dans la console
var mat = '<?php echo $matricule; ?>'; var cam = '<?php echo $cam; ?>'; var id ='<?php echo $id; ?>'; var urlup = 'upload.php?cam='+cam+'&mat='+mat+'&id='+id; // The upload script // affichage dans la console console.log('mat : ' + mat); console.log('id : ' + id); console.log('cam : ' + cam); console.log('url : ' + urlup); //appel de la fonction webcam.set_api_url(urlup);
upload.php?cam=1&mat=16-00001&id=17
<?php include("../functions/connect.php"); if(isset($_GET['id'])) $id = urldecode($_GET['id']); echo $id; if(isset($_GET['mat'])) $matricule = urldecode($_GET['mat']); echo $matricule; if(isset($_GET['cam'])) $cam = urldecode($_GET['cam']); echo $cam ; /* This file receives the JPEG snapshot from webcam.swf as a POST request. */ // We only need to handle POST requests: if(strtolower($_SERVER['REQUEST_METHOD']) != 'post'){ exit; } $folder = 'uploads/'; $filename = md5($_SERVER['REMOTE_ADDR'].rand()).'.jpg'; $original = $folder.$filename; // The JPEG snapshot is sent as raw input: $input = file_get_contents('php://input'); if(md5($input) == '7d4df9cc423720b7f1f3d672b89362be'){ // Blank image. We don't need this one. exit; } $result = file_put_contents($original, $input); if (!$result) { echo '{ "error" : 1, "message" : "Failed save the image. Make sure you chmod the uploads folder and its subfolders to 777." }'; exit; } $info = getimagesize($original); if($info['mime'] != 'image/jpeg'){ unlink($original); exit; } // Moving the temporary file to the originals folder: rename($original,'uploads/original/'.$filename); $original = 'uploads/original/'.$filename; // Using the GD library to resize // the image into a thumbnail: $origImage = imagecreatefromjpeg($original); $newImage = imagecreatetruecolor(154,110); imagecopyresampled($newImage,$origImage,0,0,0,0,154,110,520,370); imagejpeg($newImage,'uploads/thumbs/'.$filename); if($cam == 1){ $sql1 = "UPDATE tb_vacation SET imgd='{$original}' ,debut = NOW() WHERE id='".$id."' "; mysql_query($sql1)or die(mysql_error()); echo $sql1.'<br/>'; echo '<script language="Javascript"> <!-- document.location.replace("http://groupecolesdignon.com/cam/index.php?page=cam&id='.$id.'&matricule='.$matricule.'"); // --> </script>'; }else if($cam == 2){ mysql_query("UPDATE tb_vacation SET imgf='{$original}' ,fin = NOW() WHERE id='".$id."' ")or die(mysql_error()); echo '<script language="Javascript"> <!-- document.location.replace("http://groupecolesdignon.com/cam/index.php?page=cam&id='.$id.'&matricule='.$matricule.'"); // --> </script>'; } echo '{"status":1,"message":"Success!","filename":"'.$filename.'"}'; ?>
21 nov. 2016 à 18:08
incroyable mon code marchait bien en local j'ai cru que c'etait sans doute le probleme mais malgré ta solution qui marche aussi parfaitement en local ca marche pas sur mon hebergement . je comprends pas . a votre avis ça peut etre du a quoi ??
suis dessus depuis hier
21 nov. 2016 à 18:46
Que donne la console ?
21 nov. 2016 à 18:51
Mais ce que je comprends pas c'est que en local ça amrche parfaitement.
je vois pas ce que affiche la console
21 nov. 2016 à 19:33
21 nov. 2016 à 21:03