Yea I was able to get the file upload problem solved and the delete row solved. Thanks for your help. I'm sorry for doing this to you but I'm now trying to get the image to get resized when it is uploaded to the directory. As of right now it is uploading fine but the image doesn't resize it just remains its current size. Heres the code I added:
<?php
if (isset($HTTP_POST_VARS["Submit"]))
{
$title = strip_tags(trim($_POST['title']));
$teaser = strip_tags(trim($_POST['teaser']));
$content = strip_tags(trim($_POST['content']));
$date = $_POST['date'];
//upload directory.
//change to fit your need eg. files, upload .... etc.
$upload_dir = "_images/right_thing/";
//number of files to upload.
$num_files = 1;
//the file size in bytes.
$size_bytes =151200; //51200 bytes = 50KB.
//Extensions you want files uploaded limited to.
$limitedext = array("jpg","jpeg");
define ("FILE_DIR", "_images/right_thing/");
if (is_uploaded_file($_FILES['file']['tmp_name'])) {
if ($_FILES['imageupload']['type'] == "image/gif" OR $_FILES['imageupload']['type'] == "image/pjpeg" OR $_FILES['imageupload']['type'] == "image/jpeg") {
echo "Pictures Must Be in .JPG Format!";
}
else {
$name = $_POST['title'];
//Resize the image
$imgsize = GetImageSize($_FILES['file']['tmp_name']);
if (($imgsize[0] > 50) || ($imgsize[1] > 50))
{
list ($width, $height) = $imgsize;
$new_width = 50;
$new_height = 50;
$image_p = imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefromjpeg($_FILES['file']);
imagecopyresampled ($image_p, $iamge, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
imagejpeg(image_p, null, 100);
}
$result = move_uploaded_file(imagejpeg(image_p, null, 100),FILE_DIR."/$name.jpg");
// Resize the Picture for Thumbnail Size
//Insert Information Into Database
if ($result == 1) {
$query = "INSERT INTO Right_thing (date, title, teaser, content, image) VALUES ('$date', '$title', '$teaser', '$content', '$title')";
$result = mysql_query($query) or die ("couldn't add entry");
echo "File Successfuly Uploaded.";
}
else {
echo "There was problem uploading the file";
}
}
}
}