PHP Code:
<?php
$target_path = "uploads/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(isset($_POST[comment])) {
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo '<font color="Green">Comment & File Successfully Uploaded</font>';
echo '
<img src="'.basename( $_FILES['uploadedfile']['name']).'" alt=" Uploaded Image ">
<p>
<b>Comment:</b>
<p>'.$_POST[comment].'
<hr>';
} else {
echo "There was an error uploading the file, please try again!";
}
} else {
?>
<h1>Post Comment</h1>
<p>
<form enctype="multipart/form-data" action="uploader.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000">
<table>
<tr>
<td>File to Upload:</td>
<td><input name="uploadedfile" type="file"></td>
</tr>
<tr>
<td>Comment:</td>
<td><textarea name="comment"></td>
</tr>
</table>
<input type="submit" value=" Add Comment ">
<input type="reset" value=" Reset ">
</form>
<?php
}
?>
HTH
Bookmarks