problem when retrieving folder image to show it, not inside

0

My problem is that when I load an image even in a folder if it is saved in the folder from the form, but when I want to read it, it does not locate it and it is not the problem if in my bd the folder's address is being saved where my image is hosted this is the code I have to save the image in the folder from php:

$extension = '';
$ruta ='imgProductos';
$archivo = $_FILES['fotoPro']['tmp_name'];// el archivoq ue biene desde el formulario
$nombre_archivo = $_FILES['fotoPro']['name'];
$info = pathinfo($nombre_archivo);

 if ($archivo != ''){

    $extension=$info['extension'];
    if ($extension == "jpg" || $extension=="JPG" || $extension=="PNG" || $extension =="png" ){

     move_uploaded_file($archivo,'imgProductos/'.$nombrePro.'.'.$extension);
      $ruta = $ruta."/".$nombrePro.".".$extension;

    }else{
        header('location:../extend/alerta.php?msj=el formato no es valido&c=prod&p=altap&t=error');

        exit;
   }


 }else {
   $ruta="imgProductos/sinFoto.PNG";
}

and that code sent me the image with the name of the product that was introduced to this folder:

until and everything well seguarda the image in the folder and in the bd if seguarda the directory of the image so show the data stored in my bd:

THE PROBLEM IS IN THE PRAYER OF WHEN I WANT TO RECOVER MY IMAGE TO SHOW IT AND I COULD REALIZE THAT WHEN I COMMAND ATTRACT THE IMAGE IN D ELA BD DO NOT TAKE IT AND THE PREVIOUS DEFAULTS IF AND IF IT MEETS THE FORMAT THAT IS REQUESTED, US EPOR Q WHEN I CHANGE THE FOLDER imgProductos, if s show the images and after the error arises I return aguaradr another product and do not die your image until I change the folder of place that this error will happen or do not understand greetings I hope you can advise me this is the code that I want to attract my image to show:

<div class=" row">
                                                        <?php  $sel=$con->prepare("SELECT*FROM Producto where cod_catego1 =5 ");
                                                        $sel->execute();
                                                        $res=$sel->get_result();
                                                        $row=mysqli_num_rows($res);

                                                        while($f=$res->fetch_assoc()){

                                                         ?>
                                                        <div class="card col s3 ">
                                                            <form action="index.php?action=add&code=<?php echo $f["modelo"]; ?>" method="post" class="for1">
                                                                <div class="card-image">
                                                                <img src="<?php echo $f['imagen'] ?>" width="50" height="180">
                                                                <!-- <span class="card-title">Card Title</span> -->
                                                                </div>
                                                                <div class="card-content  purple-text">
                                                                    <p><?php echo $f['nombrep'] ?></p>
                                                                    <p><?php echo $f['modelo'] ?></p>
                                                                </div>

                                                                <!-- <div class="card-action"> -->
                                                                    <input type="number"  value="1" name="quantity" min="1"  class=" col s6 blue-text" autocomplete="off">
                                                                 <input type="hidden" name="hidden_name" value="<?php echo $f["nombrep"]; ?>" />
                                                                 <input type="hidden" name="hidden_price" value="<?php echo $f["precio"]; ?>" />
                                                                 <button class="btn btn-floating orange" type="submit" name="add_to_cart"><i class="material-icons right">add_shopping_cart</i></button>
                                                                    <button data-target="modal1" data-id="<?php echo $f["cod_producto"]; ?>"  value="<?php echo $f["modelo"]; ?>"  class="btn modal-trigger ver"><i class="material-icons">visibility</i></button>
                                                                    <div class="card-content">
                                                                        <p class="red-text "><?php echo "$ ".number_format($f['precio'],2); ?></p>
                                                                    </div>
                                                                </form>

                                                            <!-- </div> -->

                                                        </div>

                                                        <?php

                                                    }
                                                    $sel->close();
                                                        $con->close();
                                                    ?>

                        </div><!-- fin de row container de pruductos-->

and so some images are shown and others are not, that's how you see when you run my web page, just capture my previously saved images and the new ones do not, greetings:

    
asked by jose 12.05.2018 в 15:30
source

0 answers