Well basically, for my admin panel I want an image uploader. Obviously, since I'd be the only one using it it wouldn't need to have a size limit or anything special, just a straightforward upload to the folder "../img/projects" and for the image name to be renamed to '".$name.".png'.
The form as it stands:
<form action="compose.php" method="post">
<table><tr><td valign="top" width="100" align="left">Title</td><td align="left"><input type="text" name="title" id="text" /></td></tr>
<tr><td valign="top" align="left">Description</td><td align="left"><textarea name="description" rows="2"></textarea></td></tr>
<tr><td valign="top" align="left">Content</td><td align="left"><textarea name="content" rows="3"></textarea></tr>
<tr><td valign="top" align="left">Thumbnail</td><td align="left"><input type="file" name="thumb" id="text" /></td></tr>
<tr><td></td><td valign="middle" align="left"><input type="submit" name="submit" value="submit" />
<?php
mysql_connect("localhost","root") or die(mysql_error());
mysql_select_db("good2") or die("Could not select the database.");
if(isset($_POST['submit'])){
$name = $_POST['title'];
$desc = $_POST['description'];
$cont = $_POST['content'];
$time = date("h:ia");
$date = date("l jS F Y");
$user = $member['username'];
$query = "INSERT INTO projects (title, description, content, user, time, date) VALUES ('$name', '$desc', '$cont', '$user', '$time', '$date')";
$sql = mysql_query($query);
if(!$name) {
echo "<div id='error'>- You must enter a project name.</div>";
} elseif($sql) {
echo "<div id='error' align='right'>+ You have successfully submitted ".$name."!<br /><a href='index.php'><- back</a></div>";
} else {
mysql_error();
}
}
?></td></tr>
</table>
</form>
Any help?
Thanks.