Undefined index: la upload imagine
Discutii despre script-uri si coduri PHP-MySQL, precum si lucru cu XML in PHP.
-
evident
- Mesaje: 168
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
MarPlo
Mesaje: 4343
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
Mesaje: 168
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>
MarPlo
Mesaje: 4343
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">