Hi,

Ok there were a lot of mistakes in that code. IN fact
i rubbed it off completely and am using a new code.. 

Everything works fine now, except that if the filename
exists, any new file with the same name overwrites the
old file.. What do i do about it?

Here is the code i'm using :

<?php

$db = mysql_connect("localhost","user","pwd");
mysql_select_db("dbname",$db);

if ($img1_name != "") {
        $pic = "yes"; 
}
else {
        $pic = "no";
}

$date = date("l dS of F Y h:i:s A");

// if $img_name isn't empty, try to copy the file
if (($img1_name != "") and ($img1_size <= "256000")
and ($img1_type == "image/pjpeg") or ($img1_type ==
"image/jpeg")) {
        $sql = "INSERT INTO mjpals
(name,age,gender,country,email,date,profile,looking,pic_name,pic)
VALUES
('$name','$age','$gender','$country','$email','$date','$profile','$looking','$img1_name','$pic')";
        $result = mysql_query($sql) or die("You made a
mistake, please go back and try again");
        copy("$img1", "mjpalpics/$img1_name")
        or Die ("Could not do");
} 
?>

Thank you for adding you details. The following has
been added to the Database :<br><br>
<big>
<?php

$profile = stripslashes("$profile");
$looking = stripslashes("$looking");

echo ("
Name : $name<br>
Age : $age<br>
Gender : $gender<br>
Country : $country<br>
Email : $email<br>
Your Profile : $profile<br>
You are looking for : $looking<br>
");

if (($img1_size <= "256000") and ($img1_type ==
"image/pjpeg") or ($img1_type == "image/jpeg")) {
        
echo "
Your Photo : <i>Name - $img1_name | Size - $img1_size
| MIME Type - $img1_type</i> <br>
"; 

}
else {
        echo "No photograph uploaded, or wrong Type/Size
photograph";
}
?>


=====
Rahul S. Johari (Director)
******************************************
Abraxas Technologies Inc.
Homepage : http://www.abraxastech.com
Email : [EMAIL PROTECTED]
Tel : 91-4546512/4522124
*******************************************

__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to