Undefined index: la upload imagine

Discutii despre script-uri si coduri PHP-MySQL, precum si lucru cu XML in PHP.
Avatar utilizator
evident
Mesaje: 156

Undefined index: la upload imagine

Cod: Selectaţi tot

<div class="form-group">
    <label>Imagine</label>
    <input type="file" name="avatar">
  </div>

Cod: Selectaţi tot

$fileName = $_FILES["avatar"]["name"]; 
$fileTmpLoc = $_FILES["avatar"]["tmp_name"];
$fileType = $_FILES["avatar"]["type"]; 
$fileSize = $_FILES["avatar"]["size"];
$fileErrorMsg = $_FILES["avatar"]["error"]; 
Undefined index: avatar in toate 5 liniile
http://www.x-anunturi.ro Anunturi online gratuite

MarPlo
Cum trimiti acel fisier la server?
E vreun buton Submit, sau cu javascript?
Incearca sa adaugi tagul input intr-un form.

Cod: Selectaţi tot

<form action='file.php' method='post'>
  <label>Imagine</label>
  <input type='file' name='avatar'>
</form>

evident

Cod: Selectaţi tot

<form  action="add.php" class="form-horizontal"method="post">
 <div class="form-group">
    <label>Imagine</label>
    <input type="file" name="avatar">
  </div>
 <button class="btn btn-primary" type="submit" id="submit">Adauga anuntul</button>
 </form>
http://www.x-anunturi.ro Anunturi online gratuite

MarPlo
Adauga in <form> tagul "enctype", si spatiu intre atribute.

Cod: Selectaţi tot

<form  action="add.php" class="form-horizontal" method="post" enctype="multipart/form-data">

Subiecte similare