uisneach Posted February 11, 2009 Share Posted February 11, 2009 Hello, noob here Just ask you this I am bulding a website for a photographer. Need to upload pics from the net, choosen by client, then move this pics into the the website to be viewed I created something like this and it works. I checked and the pics are found on my linux server. So i have a table on the db mysql where the pics details are correctly saved Now I need to insert last pic uploaded on my web page, "pictureview.php."with name and descriptio but I don't really have a clue about how to make the first step!!! please, someone may give me some advices? Thx in advance:))))) Paolo $host = "xxcxcx"; $user = "xcxcxcx"; $password = "xcxcxcxx"; $dbname = "xcxcxcxcx"; $cxn = mysql_connect($host,$user,$password); mysql_select_db($dbname); if (!$cxn) { echo 'Error server MySQL'; exit(); } else { $insertSQL = "INSERT INTO foto (description) VALUES ('".$_POST['description']."')"; to mysql_select_db($dbname); $Result1 = mysql_query($insertSQL) or die(mysql_error()); $ultimo_id = mysql_insert_id(); $file_temp=($_FILES['userfile']['tmp_name']); $percorso="public/foto/"; $nuovo_nome=$percorso.$ultimo_id.".jpg"; $inviato = file_exists($file_temp); } if ($inviato) { move_uploaded_file($file_temp,$nuovo_nome); header("Location:Pictureview.php"); } else { header("Location:Errore.php"); } ?> Link to comment https://forums.phpfreaks.com/topic/144759-insert-and-view-uploaded-pics-on-the-web-page/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.