How do i upload files for my website for download.

4 replies
  • WEB DESIGN
  • |
Hi, i am not too clued when it comes to web design. I have just downloaded filezilla and uploaded an ebook to a folder on my server, but not sure how i can provide a download link for my customers to download that ebook.

I know it sounds silly and i think i am nearly there. Hope someone can enlighten me on this.
Thanks in advance.
#download #files #upload #website
  • Profile picture of the author dar
    If you uploaded the ebook to your "www" folder, you can get people to download it by making a link that points to:

    http://www.example.com/ebook.pdf

    Obviously replace example.com with your website name and ebook.pdf with the file name of your actual ebook.

    If you uploaded it to a subdirectory, all you have to do is change the path.
    For example, if you uploaded to "www/downloads/ebook.pdf", you would link to "http://example.com/downloads/ebook.pdf"


    To make a link, see here:
    HTML Links
    {{ DiscussionBoard.errors[86079].message }}
    • Profile picture of the author ThomM
      If you link to the PDF then when anyone clicks on it, it will open the PDF and they won't actually download it unless they save it when it is open.
      Robert Plank put this code in the main forum last year that will make the PDF downloadable.

      <?php

      // Change this to the filename of your PDF file
      $filename = "filename.pdf";

      if (!file_exists($filename)) {
      header("HTTP/1.0 404 Not Found");
      echo "<h1>404 Not Found</h1>";
      die();
      }

      header('Content-type: application/pdf');
      header('Content-Disposition: attachment; filename="' . basename($filename) . '"');
      echo file_get_contents($filename);
      die();

      ?>

      Change the filename that's underlined above to the name of your PDF.
      Copy the code to to a blank file in wordpad or what ever text editor you use and name it what ever you want with a .php extension, like ebook.php
      Upload that and the PDF to your site and on the web page link to that file like this http://sitename.com/ebook.php
      Then when they click on the link it will download to their computer instead of opening in their browser.
      Signature

      Life: Nature's way of keeping meat fresh
      Getting old ain't for sissy's
      As you are I was, as I am you will be
      You can't fix stupid, but you can always out smart it.

      {{ DiscussionBoard.errors[86362].message }}
      • Profile picture of the author quicksilver
        Hi,

        Just a thought.

        If someone stumbles across your download folder they could get access without you knowing so include an index.html in the folder as follows.
        **********************************
        <HTML>
        <HEAD>
        <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
        <meta name="robots" content="noindex,nofollow">
        </HEAD>
        <BODY>
        <CENTER>
        <TABLE BGCOLOR="white" WIDTH="650" BORDER="5" BORDERCOLORDARK="gray" BORDERCOLORLIGHT="white" CELLPADDING="5">
        <CENTER>
        <tr>
        <th>You are not allowed to access this area. Please <a href="http://www.your-domain.com">click here</a> to go to our main page.
        </th>
        </tr>
        </center>
        </table>
        </body>
        *************************************************

        Good luck

        Quicksilver
        The HTML Book, with free HTML code.
        Signature

        * * * * My site * * * *
        * * * * My paintings * * * *

        {{ DiscussionBoard.errors[87188].message }}
        • Profile picture of the author ripsnorta2
          Quicksilver has a good point, but instead of giving them a nasty error message, it might be better to just redirect them to the main page. Or better yet, redirect them to a sales page!

          Just do this with an index.php file and put the redirection code in that.

          Code:
          <? header("Location: http://www.mysite.com/buythisproductnow"); ?>
          {{ DiscussionBoard.errors[87902].message }}

Trending Topics