Undefined index: id_making dans C: \ xampp_ \ htdocs \ pour \ uploader.php sur la ligne 35
$id_making= $_POST['id_making'];.
$id_making= (isset($_POST['id_making']))?$_POST['id_making']:'error';
<?php require('./connect/connect.php'); /*Declaration des variables du making off*/ $titre_making= $_POST['titre_making']; $stitre_making= $_POST['stitre_making']; $date_making=$_POST['jour']."/".$_POST['mois']."/".$_POST['annee']; $photo_couv= $_FILES['photo_couv']; if(isset($_FILES['photo_couv']) AND $_FILES['photo_couv']['error']==0){ //var_dump($_FILES['photo_couv']; if ($_FILES['photo_couv']['size'] <= 5000000) { // Testons si l'extension est autorisée $infosfichier = pathinfo($_FILES['photo_couv']['name']); $extension_upload = $infosfichier['extension']; $extensions_autorisees = array('jpg', 'jpeg', 'gif','png','swf'); if (in_array($extension_upload, $extensions_autorisees)) { move_uploaded_file($_FILES['photo_couv']['tmp_name'], 'img/' . basename($_FILES['photo_couv']['name'])); echo "L'envoi a bien été effectué !"; } } } /*Declaration des variables de la video*/ $titre= $_POST['title']; $chemin= $_POST['chemin']; /*Declaration des varibles de l'image*/ $id_making= (isset($_POST['id_making']))?$_POST['id_making']:'error'; $title= $_POST['title']; $cheminimg= $_FILES['file_up']; /*** Script from: [http://coursesweb.net/ajax/] ***/ $updir = 'upload'; // Directory for uploads $max_size = 6000; // Sets maxim size allowed for the uploaded files, in kilobytes // sets an array with the file types allowed $allowtype = array('bmp', 'gif', 'htm', 'html', 'jpg', 'jpeg', 'mp3', 'pdf', 'png', 'rar', 'zip'); // if the folder for upload (defined in $updir) doesn't exist, tries to create it (with CHMOD 0777) if (!is_dir($updir)) mkdir($updir, 0777); /** Loading the files on server **/ $result = array(); // Array to store the results and errors // if receive a valid file from server if (isset ($_FILES['file_up'])) { // checks the files received for upload for($f=0; $f<count($_FILES['file_up']['name']); $f++) { $fup = $_FILES['file_up']['name'][$f]; // gets the name of the file // checks to not be an empty field (the name of the file to have more then 1 character) if(strlen($fup)>1) { // checks if the file has the extension type allowed /*$type = end(explode('.', strtolower($fup)));*/ // checks if the file has the size allowed if ($_FILES['file_up']['size'][$f]<=$max_size*1000) { // If there are no errors in the copying process if ($_FILES['file_up']['error'][$f]==0) { // Sets the path and the name for the file to be uploaded $thefile = $updir . '/' . $fup; // If the file cannot be uploaded, it returns error message if (!move_uploaded_file ($_FILES['file_up']['tmp_name'][$f], $thefile)) { $result[$f] = ' The file could not be copied, try again'; } else { // store the name of the uploaded file $result[$f] = '<b>'.$fup.'</b> - OK'; } } } else { $result[$f] = 'The file <b>'. $fup. '</b> exceeds the maximum allowed size of <i>'. $max_size. 'KB</i>'; } } } // Return the result $result2 = implode('<br /> ', $result); echo '<h4>Files uploaded:</h4> '.$result2; } /*insertion des donnees dans la table making off*/ $sql= "insert into making_off(titre_making,stitre_making,photo_couv,date_making)values('$titre_making','$stitre_making','".$_FILES['photo_couv']['name']."','$date_making')"; /*insertion des donnees de la table video*/ $sql= "insert into video_off(id_making,titre,chemin)values('$id_making','$titre','$chemin')"; /*mysql_query($sql, $link) or die(mysql_error());*/ /*test de la requete sql*/ /*echo $sql ;*/ $resultat=mysql_query($sql); /*insertion des donnees de la table image */ $sql= "insert into image_off(id_making,title,cheminimg)values('$id_making','$title','$cheminimg')"; /*mysql_query($sql, $link) or die(mysql_error());*/ /*test de la requete sql*/ /*echo $sql ;*/ $resultat=mysql_query($sql); require('test2.php'); ?>
$sql= "insert into image_off (id_making,title,cheminimg) values ('$id_making','$title','$cheminimg')";
$cheminimg= $_FILES['file_up'];
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.