0
Hello,
I have a user register where it is possible to insert a profile photo. Every time I try to insert an image, warning messages are displayed. I have tried some internet solutions but unfortunately I could not solve my problem.
Messages:
"Warning: move_uploaded_file(): The Second argument to copy() Function cannot be a directory in"
Warning: move_uploaded_file(): Unable to move
BD:
Name | Type
Image| blob
HTML:
<div class="form-group">
<label class="col-md-4 control-label" for="imagem">Imagem de perfil</label>
<div class="col-md-4">
<input type="file" name="imagem" class="btn btn-success" accept="image/*" >
</div>
</div>
PHP:
$tmpName = $_FILES['imagem']['tmp_name'];
$imagem= $_FILES['imagem']['name'];
$arqError = $_FILES['imagem']['error'];
if ($arqError == 0) {
$pasta = './uploads/';
$upload = move_uploaded_file($tmpName, $pasta);
}
PHP to display the image:
<img src="uploads/<?php=$_FILES['imagem']['name'];?>">
The PHP Notice is stating that the second argument cannot be a directory. It is very likely that you are not receiving the name of the file to be saved, but only the directory. Try to see the content of this argument used the function
var_dump($argumento);
– Carlos Andrade
@Carlosandrade thank you, I will try and in case would var_dump($image)
– Malfus