-1
I would like the user to upload his photo, but when saving, I would like it to be saved with the same name as the client’s CPF.
Today I can save the image in a folder, but it comes with the name given by the client.
PHP that saves the image in the destination folder I chose:
<?php
$cpf = $_SESSION['cpf'];
$nome_temporario=$_FILES["Arquivo"]["tmp_name"];
$nome_real=$_FILES["Arquivo"]["name"];
copy($nome_temporario,"imagens/$nome_real");
?>
HTML of the page:
<form action="envia_arquivo.php" method="post" enctype="multipart/form-data">
<div>
<label id="ftbt" for='arquivo'><img src="../FORM/Upload.svg"></label>
<input name="Arquivo" id='arquivo' type='file' required accept="image/*">
<button class="botao1" type="submit" value="Continuar">Continuar</button>
</div>
</form>
I’ve searched everything that is singing and I can’t find a PHP shape that works, most I tried didn’t send the photo to the folder.
error: Warning: copy(): The Second argument to copy() Function cannot be a directory in *** line 6
– Pedro Castilho
@Pedrocastilho in this case probably the value of
$_SESSION['cpf'];
this empty, check it, or if you want to test leave it so$cpf = 'testando_cpf'
– Neuber Oliveira
vdd... with the 'testando_cpf' was correctly... thank you
– Pedro Castilho
apparently it was just that msm... the Septssion ta empty
– Pedro Castilho