Setting value of the input file field

2

The world of the project is: I make a register where I can upload the file, save the project, I register the post, and the image in 3 types of tables, the first table tbl_PUBLICACOES, except the publications, the table tbl_IMAGENS, where saved the images sent by the upload and finally the table tbl_PUBLICACOESxIMAGENS, where saved the publication code and the code of the image. So far everything is going well, but I offer the option to change this publication, and I need this image to come from the preloaded publication.

  

Problems encountered:   The problem is how I will change this image, because the right thing would be to delete or edit the image, so that it does not fill the image server that is not attached to any file itself. How to do it the best way, I've been searching and I still have no idea how to do it.

Script that I have programmed something follows below:

<?php
    $query = mysql_query("SELECT * FROM tbl_PUBLICACOESxIMAGENS PI INNER JOIN tbl_IMAGENS I ON PI.COD_SEQUN_IMAGM=I.COD_SEQUN_IMAGM WHERE COD_IDENT_PUBLI ='" . $cdPubli . " ' ");

       while ($linha = mysql_fetch_array($query)) {
 ?>
        <div class = "fileinput fileinput-new aquiClonar" data-provides = "fileinput">
           <div class = "fileinput-preview thumbnail" data-trigger = "fileinput" style = "width: 420px; height: 190px; text-align: center;"> Tamanho esperado 420px x 190px</div>
               <div>
                  <span class = "btn btn-default btn-file"><span class = "fileinput-new">Selecionar imagem</span><span class = "fileinput-exists">Trocar</span><input type = "file" value="" name = "files[]"></span>
                   <a href = "#" class = "btn btn-default fileinput-exists" data-dismiss = "fileinput">Remover</a><br>
                     <label class = "fileinput-exists">Legenda</label>
                     <input id = "legenda" class = "fileinput-exists" value="<?php echo $linha['MEM_LEGEN_IMAGM'] ?>" name = "MEM_LEGEN_IMAGM" /><br>
                     <label class = "fileinput-exists">Link</label>
                                    <input id = "linkurl" class = "fileinput-exists" value="<?php echo $linha['TXT_LINKX_URLXX'] ?>" name = "TXT_LINKX_URLXX2" />
          </div>
       </div><?php
     }
?>
    
asked by anonymous 09.07.2015 / 14:02

1 answer

1

For security reasons it is not possible to set value="" to input . The solution found by me is to make a query and bring all the pictures related to this publication and put it in tag <img/> and allow deletion of this image.

    
09.07.2015 / 14:26