Bom dia galera,
Seguinte: Estou precisando substituir um input type="text" por um type="file", quando o usuário precisar alterar o anexo do sistema.
O código está assim:
Update.php
<tr>
<td colspan='2'><label>Arquivo Anexado: </label>
<input type="text" id="new_file_lic" name="new_file_lic" value="<?php echo $lic_anexo; ?>" readonly="" />
<input type="button" value="Detelar Arquivo" onClick="limpa()">
</td>
</tr>
OBS: a variável "$lic_anexo" exibe o caminho do arquivo anexado. (\\licencas\arquivo.pdf)
função.js
function limpa() {
if(confirm('DESEJA MESMO DELETAR ESTE ANEXO?')){
document.getElementById('new_file_lic').value="";
}
}
Quero que quando ele clique em "Deletar Arquivo", ele substitua este campo: <input type="text" id="new_file" name="new_file" value="<?php echo $lic_anexo; ?>" readonly="" />
por este: <input type="file" id="new_file" name="new_file" />
No caso para anexar um novo arquivo.
Deve ser fácil, mas não me vem a cabeça o comando hehe...