Input type file with pre-selected image

Asked

Viewed 1,016 times

0

I have the path of an image in the database ex: admin/conteudo_admin/imagem_noticia/athletes.jpg

I have this input type="file" and intended that this image was selected

<input type="file"  id="imagem" name="imagem" >
  • as thus selected?

  • with this way I am editing in backoffice

  • you can set the value in input, with php

  • but will not appear for example the file name ahead

  • explain better what you want exactly.. It’s hard to understand..

  • I’ve been running some tests. <input type="file" id="imagem" name="imagem" value="ficheiro"> does not work, does not appear "file". And for what I have been looking at: http://stackoverflow.com/questions/16365668/pre-populate-html-form-file-input. It does not give

Show 1 more comment

1 answer

1

Set this directly on ..input type="file".. can’t. You can do it in text:

<input type="file" id="imagem" name="imagem">
<span><?php echo $imagem_da_BD; ?></span>

You can also place the image right after the input:

<input type="file" id="imagem" name="imagem">
<img src="<?php echo $imagem_da_BD; ?>">
  • so will not appear for example the file name ahead

  • Try like you’re on top

Browser other questions tagged

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