how i can retrive files from folder on hard-disk and how to display uplaoded file dat

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • itsmenarwal
    New Member
    • Jan 2010
    • 20

    #1

    how i can retrive files from folder on hard-disk and how to display uplaoded file dat

    I have made a application form in which i am asking for username,passwo rd,email id and user's resume.Now after uploading resume i am storing it into hard disk into htdocs/uploadedfiles/..in a format something like this username_filena me.In database i am storing file name,file size,file type.Some coading for this i am showing here
    Code:
    $filesize=$_FILES['file']['size'];
    $filename=$_FILES['file']['name'];
    $filetype=$_FILES['file']['type'];
    $temp_name=$_FILES['file']['tmp_name'];   //temporary name of uploaded file
    $pwd_hash = hash('sha1',$_POST['password']);        
    
    
    
    $target_path = "uploadedfiles/";
    $target_path = $target_path.$_POST['username']."_".basename( $_FILES['file']['name']); 
    
    move_uploaded_file($_FILES['file']['tmp_name'], $target_path) ;   
    
    $sql="insert into employee values    ('NULL','{$_POST[username]}','{$pwd_hash}','{$filename}','{$filetype}','$filesize',NOW())";
    Now i have two questions 1.NOw how i can display this file data into a textarea(someth ing like naukri.com resume section) 2.How one can retrive that resume file from folder on hard-disk.What query should i write to fetch this file from that folder.I know how to retrive data from database but i dont know how to retrive data from a folder in hard-disk like in the case if user want to delete this file or he wnat to download this file.How i can do this
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hey.
    1. You can get the actual data from the file by using the file_get_conten ts function. After that it is just a matter of echoing it wherever you need it.
    2. The same way you created it. You just fetch the data from the database, compile the file path using the username and filename, and the do whatever you need to do with it from there. Print it, link to it, unlink it, or whatever you want to do.

    Comment

    Working...