how to view uploaded file

i have uploaded a .pdf file in my site while uploading i have also given it a serial no. now after i have uploaded the file i have stored the file name and its serial no in the database table. Now i have fetched the whole information from the database table i.e serial no and the .pdf fle name.

Till here i have done it. But the problem arises now

I want that when i click on the .pdf filename the .pdf file can be viewed on the browser. It can be done and i have done that by using the simple code where the user just defines the location of the .pdf file where situated in the machine or server but it is too bad code as every one can see the exact location of the .pdf files where situated through url. So i want that the pdf files can be viewed against there id which is generated when clicked.

For example:-


****** means fetch the slno from database table.
-------- means fetch the .pdf name from the database table.

<?php echo ----------;?>


+++++ means the .pdf file name depending on the id of the testing.php page which is passed to this page when clicked

but unfortunately it only works for image but not for any .pdf file. Is it for using tag if so how can we overcome this problem please help me out its urgent for me

Sponsor our Newsletter | Privacy Policy | Terms of Service