My form submits fine the only issue I am having is that it wont move the image to upload folder and it wont add it to the database but when i select a image it shows the image name
[php]
<?php if (isset($_POST['submit'])) { $Name = $_POST['name2']; $Description = $_POST['description']; if (empty($Name)) { $errors[] = "Name Required."; } if (!empty($errors)) { echo validation_errors($errors[0]); $file = rand(1000, 100000) . "-" . $_FILES['photo']['name']; $file_loc = $_FILES['photo']['tmp_name']; $folder = "/uploads/"; } else { move_uploaded_file($file_loc, $folder . $file); $sql = "INSERT INTO `discussion_categories`(`Name`,`Description`,`Photo`)"; $sql .= "VALUES('{$Name}','{$Description}','{$file}')"; $result = query($sql); header("Location: managecategories.php"); } } ?>[/php]
<form role="form" action="" method="post" enctype="multipart/form-data">
<div class="form-group">
<label class="form-field-label">Category</label>
<input class="form-control" type="text" id="forum_name" name="name2" value="">
</div>
<div class="form-group">
<label class="form-field-label">Description</label>
<textarea class="form-control" id="description" rows="5" name="description"></textarea>
</div>
<div class="form-group">
<label class="form-field-label">Photo</label>
<div class="columns small-12">
<input name="photo" type="file">
</div>
</div>
<input type="submit" name="submit" id="create_forum" class="" value="Add Category">
</form>