I'm developing a project and next to the form, the user can upload a file. In the case, the registration part next to the upload (s) I have already been able to do, now I am creating the view / change of the record. And that's what I'm packing.
In case, I registered the upload path and threw it in the bank bringing this path to the display / change screen with explode to split the files ... but even with explode, it still understands as a link only. As shown below.
<?
#definir o char-set da página
setlocale(LC_ALL,"pt_BR");
header('Content-type: text/html; charset=windows-1252');
set_time_limit(120); //Tempo limite de execução
ERROR_REPORTING (E_ERROR); //Exibe somente erros fatais
#Variáveis de Data e Hora
$dataAt = date('d/m/Y');
$horaAt = date('H:i:s');
$inserir = 0;
$usuario = strtolower($_SERVER["LOGON_USER"]);
$usuario_1 = split('\\', $usuario);
$usuario = $usuario_1[1];
//variaveis para execução do SQL
SQL();
global $sql;
$idd = $_REQUEST["id"];//Varíavel para buscar o campo id do registro
//echo "O ID para alteração é o: ".$idd;
//echo "<BR><BR>";
#Cria a consulta inicial
$altEve = "SELECT [id],[mudanca],[tarefa]
,[descricao],[ambiente],[empresa],[reg_afet]
,[sist_afet],[hw_afet],[host_name],[serv_afet]
,[conclusao],[obs],[data_exec],[obs2],[upload]
FROM [Passagem].[dbo].[tb_eventos_relev_tst] WHERE ID= $idd";
//echo $altPas;
//echo "<BR>";
#realiza a busca pelos dados do registro
$result = $sql->execute($altEve);
if($tbl = $result)
{
$codigo = $tbl["id"];
$codigo = $tbl["mudanca"];
$codigo = $tbl["tarefa"];
$codigo = $tbl["descricao"];
$codigo = $tbl["ambiente"];
$codigo = $tbl["empresa"];
$codigo = $tbl["reg_afet"];
$codigo = $tbl["sist_afet"];
$codigo = $tbl["hw_afet"];
$codigo = $tbl["host_name"];
$codigo = $tbl["serv_afet"];
$codigo = $tbl["conclusao"];
$codigo = $tbl["obs"];
$codigo = $tbl["obs2"];
$codigo = $tbl["data_exec"];
$codigo = $tbl["upload"];
}
else
{ echo "Registro não localizado"; }
#Inicia o tratamento dos registros
while (!$result -> EOF) {
$id = $result->Fields['id']->Value;
$mudanca = $result->Fields['mudanca']->Value;
$tarefa = $result->Fields['tarefa']->Value;
$descricao = $result->Fields['descricao']->Value;
$ambiente = $result->Fields['ambiente']->Value;
$empresa = $result->Fields['empresa']->Value;
$reg_afet = $result->Fields['reg_afet']->Value;
$sist_afet = $result->Fields['sist_afet']->Value;
$hw_afet = $result->Fields['hw_afet']->Value;
$host_name = $result->Fields['host_name']->Value;
$serv_afet = $result->Fields['serv_afet']->Value;
$conclusao = $result->Fields['conclusao']->Value;
$obs = $result->Fields['obs']->Value;
$data_exec = $result->Fields['data_exec']->Value;
$obs2 = $result->Fields['obs2']->Value;
$upload = $result->Fields['upload']->Value;
$dataEx = substr($data_exec, 8,2)."/".substr($data_exec,5,2)."/".substr($data_exec, 0,4);
//echo $upload;
//echo "<BR>";
$uploadExi = explode(' , ',$upload);
//foreach($uploadExi as $valores)
//{
//echo $valores.'<BR>';
//}
#Move para o registro seguinte
$result->MoveNext();
}
And in the Html below
...
<p>
<label>Anexo:</label>
<input type="hidden" name="eveArquivoAntigo" id="idArquivoAntigo" value="<? echo $upload; ?>" />
<?
if($upload == '' || $upload == 'Sem arquivo anexo') {
echo 'Não existem arquivos anexos para este registro';
} else {
?>
<a href="../UTILS/<?foreach($uploadExi as $valores) { echo $valores; } ?>" target="_blank">
<?foreach($uploadExi as $valores) { echo $valores.'<BR>'; }?></a><br>
<?
}
?>
</p>
<p>
<label for="idArquivo">Alterar anexo:</label>
<input type="file" name="eveArquivo[]" id="idArquivo" disabled />
</p><br>
In the case what could be done so that each part of the file is handled with a different link? And taking advantage of the change (field below) the old file will probably have to be deleted from the server ... is there any way other than Ulink?