Jump to content

Recommended Posts

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.