Author Topic: Need solution to download files from local host  (Read 259 times)

Ponmozhi

  • New Member
  • *
  • Posts: 1
  • Karma: 0
    • View Profile
Need solution to download files from local host
« on: May 16, 2012, 02:12:12 PM »
The below codes are my upload.php file, i use to upload my files to the localhost in a folder(Created folder for specific user).I want to view the files uploaded in to the folder and i want to have download options(link with filename) to download files from that folder.Can any one write  code for that(download.php) i am in a desperate situation   :( .
 <?php

 $fname = $_POST['fname'];
 $target = "uploads/$fname/";
 $target = $target . basename( $_FILES['uploaded']['name']);
 $ok=1;
 if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
 {
 echo "The file ". basename( $_FILES['uploaded']['name']). " has been uploaded";
 }
 else {
 echo "Sorry, there was a problem uploading your file.";
 }

 ?>