Planning a basic image up load to start, not done it before. Having a problem with the form not passing the picture to the PHP file. The errors i am recieving are;
Notice: Undefined index: file in C:\Users\PC\Documents\XAMPP\htdocs\php\addpic.php on line 2 Notice: Undefined index: file in C:\Users\PC\Documents\XAMPP\htdocs\php\addpic.php on line 8 Notice: Undefined index: file in C:\Users\PC\Documents\XAMPP\htdocs\php\addpic.php on line 9 Notice: Undefined index: file in C:\Users\PC\Documents\XAMPP\htdocs\php\addpic.php on line 10 Notice: Undefined index: file in C:\Users\PC\Documents\XAMPP\htdocs\php\addpic.php on line 11
HTML form
<div id="addpicdialog" title="Change Pic">
<p>Please Fill in out member information.</p>
<form name="changepic" method="POST" action="php/addpic.php?id=<?php echo $id ?>" >
<p>DISPLAY CURRENT PIC HERE</p>
<label for="file">Filename:</label>
<input type="file" name="file" id="file"><br>
<input name="submit" type="submit" value="Submit" id="submit" />
</form>
</div>
addpic.php
<?php
if ($_FILES["file"]["error"] > 0)
{
echo "Error: " . $_FILES["file"]["error"] . "<br>";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "<br>";
echo "Type: " . $_FILES["file"]["type"] . "<br>";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>";
echo "Stored in: " . $_FILES["file"]["tmp_name"];
}
?>
enctype="multipart/form-data"to your form.