june_c21 Posted March 14, 2008 Share Posted March 14, 2008 I am doing a menu where user can input the title and upload the file but once they upload the file how to make the link to the title so that user can just click on the title to view the file. <?php $host = 'localhost'; $user = 'root'; $password = ''; $dbase = 'drawing'; $dblink = mysql_connect($host,$user,$password); mysql_select_db($dbase,$dblink); $file = $_POST['file']; $gf = $_POST['gf']; $drawing_no = $_POST['drawing_no']; $manufac_no = $_POST['manufac_no']; $title = $_POST['title']; $query= "INSERT INTO drawings( gf,drawing_no,manufac_no,title) VALUES ('$gf', '$drawing_no','$manufac_no','$title') "; $result = mysql_query($query,$dblink); $idir = "c:/PI/"; // Path To Images Directory $_FILES['file']['name']; // Set $url To Equal The Filename For Later Use $copy = copy($_FILES['file']['tmp_name'], "$idir" . $_FILES['file']['name']); // Move Image From Temporary Location To Permanent Location if ($copy) // If The Script Was Able To Copy The Image To It's Permanent Location print 'Drawing uploaded successfully.<br />'; // Was Able To Successfully Upload Image ?> Link to comment https://forums.phpfreaks.com/topic/96135-how-to-link-file/ Share on other sites More sharing options...
Lamez Posted March 14, 2008 Share Posted March 14, 2008 what about <?php $q = "SELECT * FROM `drawings`"; $r = mysql_query($q); $row = mysql_fetch_array($r); $title = $row['title']; $file = $row['file']; echo '<a href="'.$file.'">'.$title.'</a>'; ?> would that work for ya? Link to comment https://forums.phpfreaks.com/topic/96135-how-to-link-file/#findComment-492145 Share on other sites More sharing options...
june_c21 Posted March 14, 2008 Author Share Posted March 14, 2008 how to save the user upload filename into database. Link to comment https://forums.phpfreaks.com/topic/96135-how-to-link-file/#findComment-492239 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.