+ Reply to Thread
Results 1 to 5 of 5

Thread: Uploading files so they can be downloaded by a link

  1. #1
    trainzguy1160 is offline x10Hosting Member trainzguy1160 is an unknown quantity at this point
    Join Date
    Aug 2007
    Posts
    13

    Uploading files so they can be downloaded by a link

    I've come here to ask a few important questions on how to upload your files so that users can download them via a link on your website. 1. Where do you upload your files (i.e. which directory) to so that they can be downloaded by your users and 2. How do you link to the files that you want to be downloaded by others? I've tried numerous things, but either they don't work or I get a 404 error (page not found)
    3. Do all uploaded files have to be in .zip format?
    I'd really appreciate it if someone showed me how.
    trainzguy ;)

  2. #2
    Fedlerner's Avatar
    Fedlerner is offline Retired Fedlerner is an unknown quantity at this point
    Join Date
    Aug 2006
    Location
    Buenos Aires, Argentina
    Posts
    12,923

    Re: Uploading files so they can be downloaded by a link

    1) You need to upload the files under your public_html directory. You can create subfolders under that directory if you want too.
    2)If you upload to your public_html folder, the file test.rar, it will be able to download at: http://trainzguystrainz.x10hosting.com/test.rar
    3) You can upload files with any extension.
    Federico Lerner
    Former x10Hosting Administrator - Staff Manager

  3. #3
    trainzguy1160 is offline x10Hosting Member trainzguy1160 is an unknown quantity at this point
    Join Date
    Aug 2007
    Posts
    13

    Wink Re: Uploading files so they can be downloaded by a link

    Thanks, but whenever I do this and try to link to it (the file) it gives me a 404 error.
    Additionally, are files allowed to have spaces and will this affect the way people can download it?
    So, if I wanted to have a subdirectory it would be: www.yourname.com/public_html/subdir/ ?
    (This is just to find out what the proper link would be for getting to files)
    Here is what I mean for the 404 error: http://www.trainzguystrainz.x10hosti...20Run%20V2.zip
    This link doesn't work even though the file is in public_html. Am I not doing something right?
    If so what am I not doing right?
    EDIT: I've just managed to get this right.
    Edit:
    Thanks fedlerner for helping me!
    Now my files are up and running!
    Thanks!
    trainzguy
    Last edited by trainzguy1160; 09-11-2007 at 03:06 AM. Reason: Automerged Doublepost

  4. #4
    Anna's Avatar
    Anna is offline I am just me Anna is a name known to allAnna is a name known to all
    Join Date
    Aug 2007
    Location
    Sweden
    Posts
    6,569

    Re: Uploading files so they can be downloaded by a link

    if you were to have it in a subdir it would be: www.yourname.com/subdir/

    as for the link you provide (http://www.trainzguystrainz.x10hosti...20Run%20V2.zip)

    the folder name public_html needs taken outm as well as the double domain addy so the link becomes:

    http://www.trainzguystrainz.x10hosti...20Run%20V2.zip

    a general advice is to keep spaces out of filenames on the web.
    Last edited by Anna; 09-11-2007 at 12:34 PM.

  5. #5
    Pingy's Avatar
    Pingy is offline x10Hosting Member Pingy is an unknown quantity at this point
    Join Date
    Sep 2007
    Posts
    46

    Re: Uploading files so they can be downloaded by a link

    Well, there's a solution to your problem when it comes to PHP pages. If you've got a PHP file, and you want to prompt the user to download it instead of showing its contents, you include this somewhere on the page (best near the top):

    PHP Code:
    <?php
    header
    ('Content-type: application/octet-stream');
    ?>
    If, however, you're attempting to apply this concept to other file types, you'll need to do it through .htaccess by explicity declaring the application/octet-stream MIME type for files with the extensions you'd like. To do that, I recommend placng all of the "downloadable" files into their own directory, creating an .htaccess file in that directory, then including the line below for each extension you'd like to be treated as a download.

    /home/#USERNAME#/public_html/#DOWNLOADS#/.htaccess:
    Code:
    AddType application/octet-stream .mp3
    AddType application/octet-stream .gif
    The example above would make all mp3 and gif files in the #DOWNLOADS# directory prompt the user to download them rather than displaying their contents. To add more file types, simply mimic the examples provided. Hope I've helped...

+ Reply to Thread

Similar Threads

  1. googkle.com
    By dsfreak in forum Off Topic
    Replies: 17
    Last Post: 07-12-2006, 05:09 PM
  2. uploading files
    By Kyle87 in forum Free Hosting
    Replies: 1
    Last Post: 04-23-2006, 06:56 PM
  3. Free Software for your Computer
    By Chris S in forum Computers & Technology
    Replies: 48
    Last Post: 04-21-2006, 02:57 PM
  4. Replies: 0
    Last Post: 09-21-2005, 03:49 AM
  5. uploading folders not files
    By cheese1421 in forum Free Hosting
    Replies: 5
    Last Post: 09-05-2005, 03:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers