Here is my full code.. Please review it!
Also, thanks for the input on the casing and fields, but I even tried both ways, Vehicle_Image and Vehicle Image, still with no luck..
<?php require_once('..mydatabase'); ?>
<?php
if ($HTTP_POST_VARS['submit']) {
print_r($HTTP_POST_FILES);
if (!is_uploaded_file($HTTP_POST_FILES['file']['tmp_name'])) {
$error = "You did not upload a file!";
unlink($HTTP_POST_FILES['file']['tmp_name']);
// assign error message, remove uploaded file, redisplay form.
} else {
//a file was uploaded
$maxfilesize=10240;
if ($HTTP_POST_FILES['file']['size'] > $maxfilesize) {
$error = "file is too large";
unlink($HTTP_POST_FILES['file']['tmp_name']);
// assign error message, remove uploaded file, redisplay form.
} else {
if ($HTTP_POST_FILES['file']['type'] != "image/gif" AND $HTTP_POST_FILES['file']['type'] != "image/pjpeg") {
$error = "This file type is not allowed";
unlink($HTTP_POST_FILES['file']['tmp_name']);
// assign error message, remove uploaded file, redisplay form.
} else {
//File has passed all validation, copy it to the final destination and remove the temporary file:
copy($HTTP_POST_FILES['file']['tmp_name'],"/members/images/".$HTTP_POST_FILES['file']['name']);
unlink($HTTP_POST_FILES['file']['tmp_name']);
print "File has been successfully uploaded!";
exit;
}
}
}
}
$res = mysql_query("insert into membersrigs (Vehicle Image) values ('" . $_FILES['tmp_name']['name'] . "')");
if (isset($HTTP_POST_FILES['file']))
echo 'file'
?>
<html>
<head></head>
<body>
<form name="form1" method="POST" enctype="multipart/form-data">
<?=$error?>
<br>
<br>
Choose a file to upload:<br>
<input type="file" name="file">
<br>
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>