Setting input file field value

Asked

Viewed 1,245 times

2

The world of the project is: I register where I can upload the file, when saving the whole 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 save the images uploaded and last the table tbl_PUBLICACOESxIMAGENS, where save the publication code and the image code. So far everything is going right, however I offer the option to change this publication, and I need to come this image related to publication already loaded.

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 connected to any file itself. How to do the best way, I’ve been researching and still have no idea how to do.

Script I’ve already 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
     }
?>
  • cannot assign value to input file for basic security reasons.

  • How should I solve this problem of mine ?

  • You can let me find a way out. I’ll formulate an answer

1 answer

1

For safety reasons it is not possible to define a value="" to the input. The solution I found is to make a query and bring all images pertaining to this publication and put on tag <img/> and allow deletion of this image.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.