Creating a File Download Area on Your Website

This help page explains how to use your domain hosted with Cruzio to transfer files to your friends and colleagues without having to give them login information to access those files. Instead, you create a download area on your website, to which you upload the files you want transferred. Then to transfer the file, you send an email containing a link to the file, which can then be clicked to download it.

Creating a .htaccess file

To set up this type of file transfer, you will need to include a .htaccess file in your domain. This .htaccess makes it so that a link to a file downloads the file, instead of just showing it in the Web browser.

  1. Start a new document in any simple text editor, like Notepad or TextEdit.
  2. Copy and paste the following code into that new file:
    AddType application/octet-stream .extension

    In the code, replace .extension with the extension of the file type that you want to be downloaded. For example, if you wanted to transfer JPG files, it would say:

    AddType application/octet-stream .jpg

    If you wanted to transfer PDF files, it would instead read:

    AddType application/octet-stream .pdf

    If you plan to transfer multiple file types, include one line for each file type.

  3. Now save your new file. For the time being, save it as htaccess – Note that there is no dot in front of the file name. This is because if we included that dot now, it might make the file become hidden from view. If your text editor requires that you add an extension, try to save it as htaccess.txt – we will be renaming this later.

Setting up your download directory

Now that you have your .htaccess file ready, it is time to set up a download folder, or directory. You will put the files that you want to transfer in this directory.

  1. Log in to your Web space, using either an FTP program or your website’s File Manager. (Note: if you have Cruzio Classic hosting, the File Manager is not available, and you must use FTP instead.)If you are using an FTP program, make sure it is set to view hidden files. (Otherwise, any file starting with a dot, such as the .htaccess file, will be hidden from view.)In the File Manager or your FTP program, go to the root directory (the folder containing your website files) of your website. For Classic hosting, this will be the directory pub_html. For other hosting plans, this will be the directory httpdocs.
  2. In the root directory, create a new directory. Name the directory download, transfer, or whatever you prefer. For the remainder of this document, it will simply be referred to as the download directory. Once the new directory is created, go into that directory.
  3. Upload the htaccess.txt file you created earlier into your new directory. Now rename the htaccess.txt file to.htaccess — note that a period has been added to the beginning, and the file extension has been removed from the end.

Using your new download directory to transfer a file

Setup is now complete. You may start transferring files.

  1. Upload a file you want to transfer into the download directory that you just set up.
  2. Test it to confirm it works. Send yourself an email that includes a link to the file you just uploaded. For example, if you uploaded the file picture.jpg to your download directory on your website http://www.yourdomain.com, you would email this link:http://www.yourdomain.com/download/picture.jpgWhen you click that link in the email, it will ask if you want to download the file.
  3. Once you confirm it is working, send the email with the link to whoever you want to transfer it to. When you no longer need the file available for download, delete the file from your download directory to free up space on your website.

Making your download directory public or private

If your domain is with our Classic hosting, your download directory has been public up until now. This means that if you provided a link to the directory itself instead of a file in it, it would display a list of all the files in the download directory. You could then click any of the file names to download that file. This is useful if you want to provide one link for multiple files in your download folder. So for example, if you had your download directory on your website http://www.yourdomain.com, the link would look like this:

http://www.yourdomain.com/download/

Anyone who clicked that link would see the list of files in the download directory.

If your domain is instead with our Website Hosting services, the download directory you created is private. This means that if you tried to provide a link to the directory, it would give an error stating you do not have permission to access that directory. The only way anyone could get to any files in it would be if they had a direct link to a specific file.

It is possible to make the directory public or private depending on your preference.

  • If you want your download directory to be private, include one extra line at the beginning of your .htaccess file that reads:
    Options -Indexes
  • If you want your download directory to be public, include this extra line at the beginning of your .htaccess file:
    Options +Indexes