I wrote a script to load a picture into the database (in the database the path, the picture in the directory). Everything is well prescribed only the picture in the directory does not appear. Maybe I'm doing it wrong? I give a piece of code responsible for loading ....
if ($erro!=true){ $file=$_POST['myfile']['name']; $dir='http://localhost/bol/img/'; $up_file=$dir.basename($file); echo ($up_file); if (is_uploaded_file($_FILES['myfile']['tmp_name'])) { $n=mt_rand(0,997); $file_path=$dir.$n.jpeg; if (!file_exists($file_path)) { $_FILES['myfile']['name']=$n.'.'.jpeg; move_uploaded_file($_FILES['myfile']['tmp_name'],$dir.$_FILES['myfile']['name']); $put=$dir.$_FILES['myfile']['name']; } dbConnect(); mysql_query("INSERT INTO image (put, nazv,opis,kto_kuda) VALUES ('{$put}','{$nazv}','{$opis}','{$kto_kuda}')") or die (mysql_error()); }}
Loading takes place through the form ( <form method="post" enctype="multipart/form-data">
)