Hi there,
If you're just starting, have the database information be one part of the process, and the picture be a second step. This will make it much easier if you're a beginner.
I've attached a file that should be of help in uploading:
<html>
<head>
<title>Upload Images</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<font face="Verdana, Arial, Helvetica, sans-serif" size="-1">
<?if($submit){
//see if it's good
$extArray=explode('.', $HTTP_POST_FILES['userfile']['name']);
if(is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name']) and $extArray[sizeof($extArray)-1]=='jpg'){
$formOK=1;
}
if($formOK){
if($thumb){$location='thumb';}else{$location='large';}
//delete the existing version of the file, otherwise I encounter problems
@unlink("/path/to/file/" . $HTTP_POST_FILES['userfile']['name']);
//upload the image
copy($HTTP_POST_FILES['userfile']['tmp_name'], "../../images/$location/" . $HTTP_POST_FILES['userfile']['name']); ?>
Your file was successfully uploaded, add another if you like.<br>
<?php
echo "File name: " . $HTTP_POST_FILES['userfile']['name'] . "<br>";
echo "File size: " . $HTTP_POST_FILES['userfile']['size'] . "<br>";
?>
<?php
}else{
//?>
There was an error in your upload. Please make sure your extension is a lower
case .jpg and the path is correct.
<?php
}
}?>
</font>
<form name="form1" method="post" action="<?php echo $PHP_SELF;?>?submit=1" enctype="multipart/form-data">
<font face="Verdana, Arial, Helvetica, sans-serif" size="-1">
<input type="file" name="userfile" size="55">
<br>
<input type="submit" name="Submit" value="Submit">
<input type="checkbox" name="thumb" value="1" <?php if($thumb){echo 'checked';}?>>
Place this in the thumbnails folder</font>
</form>
</body>
</html>