Ave,

I have a simple file upload form, which uploads without a problem.
Today I added the file_exists() function to my PHP code. And everything
stopped working. What am I doing wrong here:

<?php
if($upload_file) {
$db = mysql_connect("localhost","usr","pwd");
mysql_select_db("imsafm",$db);
$date = date("m-d-Y, D, H:i");
$trauma = 'imsafm/$PHP_login/$img1_name';
if (file_exists($trauma)) {
   echo "The file $img1_name already exists. Please choose a different
name.";
 }
else { 
$sql = "INSERT INTO file (login,filename,descr,size,uppedby,date) VALUES
('$PHP_login','$img1_name','$desc','$img1_size','$PHP_login','$date')";
$result = mysql_query($sql) or die("There is a problem.");
copy("$img1", "imsafm/$PHP_login/$img1_name") or die("Could not do");
echo "<br><b><i><small>File $img1_name uploaded to $PHP_login
folder.</small></i></b><br>";
}
}
?>

I'm not getting any errors (for some reason I don't on my MAC browser, just
a blank white page whenever PHP doesn't work).

Thanks.

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

Reply via email to