Código PHP:
Ver original
<?php }else{ $portada=""; if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/jpg") || ($_FILES["file"]["type"] == "image/pjpeg") || ($_FILES["file"]["type"] == "image/x-png") || ($_FILES["file"]["type"] == "image/png"))){ //Verificamos que sea una imagen if ($_FILES["file"]["error"] > 0){ //verificamos que venga algo en el input file echo "Error numero: " . $_FILES["file"]["error"] . "<br>"; }else{ //subimos la imagen $portada= $random.'_'.$_FILES["file"]["name"]; echo $_FILES["file"]["name"] . " Ya existe. "; }else{ "../portada_bonus/" .$random.'_'.$_FILES["file"]["name"]); $id=$_POST['id']; $nombresyapellidos=$_POST['nombresyapellidos']; $total_fotos=$_POST['total_fotos']; $total_videos=$_POST['total_videos']; $link_descarga_images=$_POST['link_descarga_images']; $link_descarga_videos=$_POST['link_descarga_videos']; $Sql="UPDATE top_bonus SET portada='$portada', nombresyapellidos='$nombresyapellidos', total_fotos='$total_fotos', total_videos='$total_videos', link_descarga_images='$link_descarga_images', link_descarga_videos='$link_descarga_videos' WHERE id='$id'"; echo "<div class='col s12 card-panel cyan darken-4 center'> <h5 class='black-text text-darken-2 center CONDENSED LIGHT5'> ¡ Exelente: El Registro a sido Actualizado Correctamente ! </h5> </div>"; } } }else{ echo "<div class='col s12 card-panel blue lighten-2 center'> <h5 class='black-text text-darken-2 center CONDENSED LIGHT5'> ¡ Ups Aviso: El Registro no se Pudo Actualizar ! </h5> </div>"; } } ?>
anexo código del formulario donde se reciben los datos
Código PHP:
Ver original
<?php $id= $_POST['id']; $sql = "SELECT * FROM top_bonus where id='$id'"; { ?> <form class="col s12" name="frmContacto" enctype="multipart/form-data" method="POST"> <input type="hidden" name="id" value="<?=$id?>"/> <div class="row"> <img src='../portada_bonus/<?= $campo['portada'] ?>' class=responsive-img circle center-align width='50px' height='50px'> <div class="file-field input-field"> <div class="btn waves-effect blue darken-4"> <span>Archivo</span> <input type="file" name="file" multiple> </div> <div class="file-path-wrapper"> <input class="file-path validate" type="text" placeholder="Actualizar Portada Bonus"> </div> </div> </div> <div class="row"> <div class="input-field col s6"> <input type="text" name="nombresyapellidos" value='<?php echo $campo['nombresyapellidos']; ?>' length="60" autocomplete="off" title="Se Necesita Ingresar Los Nombres y Apellidos!" autofocus required/> <label for="nombresyapellidos" class="black-text text-darken-4">Nombres y Apellidos:</label> </div> <div class="input-field col s3"> <input type="number" name="total_fotos" value='<?php echo $campo['total_fotos']; ?>' length="2" autocomplete="off" title="Se Necesita el numero de fotos!" autofocus required/> <label for="total_fotos" class="black-text text-darken-4">Total Fotos:</label> </div> <div class="input-field col s3"> <input type="number" name="total_videos" value='<?php echo $campo['total_videos']; ?>' length="2" autocomplete="off" title="Se Necesita el numero de videos!" autofocus required/> <label for="total_videos" class="black-text text-darken-4">Total videos:</label> </div> </div> <div class="row"> <div class="input-field col s6"> <input type="text" name="link_descarga_images" value='<?php echo $campo['link_descarga_images']; ?>' length="100" autocomplete="off" title="Se Necesita Ingresar el link descarga imagenes!" autofocus required/> <label for="link_descarga" class="black-text text-darken-4">Link Descarga Imagenes:</label> </div> <div class="input-field col s6"> <input type="text" name="link_descarga_videos" value='<?php echo $campo['link_descarga_images']; ?>' length="100" autocomplete="off" title="Se Necesita Ingresar el link descarga videos!" autofocus required/> <label for="link_descarga" class="black-text text-darken-4">Link Descarga Videos:</label> </div> </div> <div class="center-btn"> <button class="btn waves-effect blue darken-4 btn-large modal-trigger tooltipped" data-position="bottom" data-tooltip="Actualizar" type="submit" name="actualizar"> Actualizar </button> <button class="btn waves-effect blue darken-4 btn-large modal-trigger tooltipped" data-position="bottom" data-tooltip="Borrar Datos" type="reset" > Borrar </button> <a href='consultar_bonus.php' <button class='btn waves-effect blue darken-4 btn-large tooltipped' data-position='bottom' data-tooltip='Volver Atrás' type='submit'> Volver </button></a> <input type='hidden' name='id' value='$campo[id]'> <input type='hidden' name='portada' value='$campo[portada]'> </form> <?php } ?>
cuando trato de hacer la actualización por medio del id, me explico de un registro en especifico me lo muestra perfectamente, pero me muestra el siguiente error:
Código:
Notice: Undefined index: file in C:\xampp\htdocs\avisex69\admin69\actualizar_bonus.php on line 69 Notice: Undefined index: file in C:\xampp\htdocs\avisex69\admin69\actualizar_bonus.php on line 73 Notice: Undefined index: file in C:\xampp\htdocs\avisex69\admin69\actualizar_bonus.php on line 74 Notice: Undefined index: file in C:\xampp\htdocs\avisex69\admin69\actualizar_bonus.php on line 75 Notice: Undefined index: file in C:\xampp\htdocs\avisex69\admin69\actualizar_bonus.php on line 76 Notice: Undefined index: file in C:\xampp\htdocs\avisex69\admin69\actualizar_bonus.php on line 77 Notice: Undefined index: file in C:\xampp\htdocs\avisex69\admin69\actualizar_bonus.php on line 78
que hace referencia e esto:
Código:
ya esto me tiene full estres, si me podrían echar una manito, gracias $temp = explode(".", $_FILES["file"]["name"]); $extension = end($temp); $portada=""; $random=rand(1,999999); if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/jpg") || ($_FILES["file"]["type"] == "image/pjpeg") || ($_FILES["file"]["type"] == "image/x-png") || ($_FILES["file"]["type"] == "image/png"))){