View files uploaded through form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • agarwalsrushti
    New Member
    • Feb 2008
    • 63

    #1

    View files uploaded through form

    Hi,
    I have made a registration form for job site in which the user uploads a .doc or .txt file through form along with the other details stored in the database. The uploaded files is sored in the upload folder that i created in working directory and not in the database. Now when someone enters the search page and enters the search criteria the name of the users with that criteria are listed. When i ckick on the name of any user then his details are displayed which he filled during registration. Now i want that the details page that is displayed should also give the user a link to view the file uploaded by that particular user whose details are diaplayed. How can i assign a link to view the uploaded file that is not in the database but in some folder. Can this be done. Plz let me know.
    Thanks.
  • agarwalsrushti
    New Member
    • Feb 2008
    • 63

    #2
    The name of the file is stored in the database.

    Comment

    • ronverdonk
      Recognized Expert Specialist
      • Jul 2006
      • 4259

      #3
      Depends whether you want to download it first to the user and then view it or want to show it to the user directly. You know how to download. For the direct view you can read the file yourself, translate any newlines to <br> and just echo it to the screen.
      [php]$file = 'your_textfile_ on_server';
      $fh = fopen($file, 'r+');
      $text = fread($fh, filesize($file) );
      $text = nl2br(strip_tag s($text));
      fclose($fh);
      echo $text;[/php]Ronald

      Comment

      Working...