Download file problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Slaxer13
    New Member
    • Jun 2014
    • 106

    #16
    where you have base path its where i put the path to the folder right?
    the folder is in the root folder

    Comment

    • computerfox
      Contributor
      • Mar 2010
      • 276

      #17
      So then you would remove $basepath?
      Don't just copy/paste the code provided....
      As a programmer you never assume, so in your case if $basepath is the root, you remove $basepath.

      Also, if it's important to provide information of the file, that is normally done in the table where you have the list of files. How am I suppose to know what type of a file you're making me download?
      Last edited by computerfox; May 22 '15, 02:24 PM. Reason: More details.

      Comment

      • Slaxer13
        New Member
        • Jun 2014
        • 106

        #18
        ok i will try it at night and post the result. Thanks to both for all your help :)

        Peace,
        Slaxer13

        Comment

        • computerfox
          Contributor
          • Mar 2010
          • 276

          #19
          Good luck and keep on coding!

          Comment

          • Slaxer13
            New Member
            • Jun 2014
            • 106

            #20
            Always ;)

            Peace,
            Slaxer13

            Comment

            • Slaxer13
              New Member
              • Jun 2014
              • 106

              #21
              I only now saw your post update. In my table there is that info about the file

              Comment

              • computerfox
                Contributor
                • Mar 2010
                • 276

                #22
                Okay, great. How does the code look now? Are you providing the right path in the table?

                Comment

                • Slaxer13
                  New Member
                  • Jun 2014
                  • 106

                  #23
                  The folder is in the root folder so i suppose this is what you told me to do

                  Code:
                  <?php
                      require 'dbconfig.php';
                   
                      $query = "SELECT * FROM tbl_uploads";
                      $result = mysql_query($query) or die('Error, query failed');
                   
                      if(mysql_num_rows($result)==0){
                          echo "Database is empty <br>";
                      }
                       else{
                          while(list($id, $name,$name) = mysql_fetch_array($result)){
                              $path="/uploads".$name;
                              echo "<a href='$path'>$name</a><br>";
                          }
                      }
                  ?>

                  Comment

                  Working...