
11-14-04, 02:59 PM
|
 |
Aspiring Coder
|
|
Join Date: Oct 2003
Posts: 510
Thanks: 1
Thanked 1 Time in 1 Post
|
|
Sorry, but it isn't working. Here is my upload script....
PHP Code:
$file_types = array( 'image/pjpeg' => 'jpg', 'image/jpeg' => 'jpg', 'image/gif' => 'gif', ); $mm=$_POST['mm']; $dd=$_POST['dd']; $yyyy=$_POST['yyyy']; $main_title=$_POST['main_title']; $category_name=$_POST['category_name']; $bus_name=$_POST['bus_name']; $personal_name=$_POST['personal_name']; $pword=$_POST['pword']; $phone=$_POST['phone']; $address=$_POST['address']; $city=$_POST['city']; $zip_code=$_POST['zip_code']; $email=$_POST['email']; $web_url=$_POST['web_url']; $mon_hours=$_POST['mon_hours']; $tue_hours=$_POST['tue_hours']; $wed_hours=$_POST['wed_hours']; $thu_hours=$_POST['thu_hours']; $fri_hours=$_POST['fri_hours']; $sat_hours=$_POST['sat_hours']; $sun_hours=$_POST['sun_hours']; $location=$_POST['location']; $desc=$_POST['desc']; $info=$_POST['info']; $plan_agreement=$_POST['plan_agreement']; $list_plan=$_POST['list_plan']; $confirm_question=$_POST['confirm_question']; $confirm_answer=$_POST['confirm_answer']; $bus_name=addslashes($bus_name); $location=addslashes($location); $desc=addslashes($desc); $info=addslashes($info); $max_size = 20000; $filesize = $_FILES['upfile']['size']; $filetype = $_FILES['upfile']['type']; $upload_dir = $_SERVER['DOCUMENT_ROOT'] . "/blah/ad_images/";
$photo = substr(sha1(rand(10, time())), 0, 8) . '.' . $file_types[$filetype]; if (move_uploaded_file($_FILES['upfile']['tmp_name'], $upload_dir . $photo)) {
include("siteinfo.php"); require("rand_num.php"); include("connect.php"); $conn = mysql_connect(localhost,"$dbuser","$dbpass") or die ("Could not connect MySQL"); mysql_select_db("$db") or die ("Could not open database"); $query = "INSERT INTO listings VALUES('','$mm', '$dd', '$yyyy', '$main_title','$category_name','$bus_name','$personal_name','$pword','$phone','$address','$city','IN','$zip_code','$email','$web_url','$mon_hours', '$tue_hours','$wed_hours','$thu_hours','$fri_hours','$sat_hours','$sun_hours', '$location','$desc','$info','$photo','$plan_agreement','$list_plan','N','0','$account','$confirm_question','$confirm_answer','0','0','0')"; $result=mysql_query($query); }
I want the image name to go into the '$photo' field in the database.
|