Allow users to download file from your site

I was recently asked to provide a download link to allow users of my website to download a file (a word document).

After an initial Google it seemed that this was going to be a lot more complicated than I thought, but in reality the solution is incredibly simple!

  1. Within your website, create a folder (e.g. named downloads) where you will keep the files that users can download.
  2. Within your webpage (or ASP.NET page) add a simple anchor tag (that's the <a>... </a> you usually use for links.
  3. Set the href property to the location of the file to download.
It's that simple - so you should end up with a tag like:

<a href="../Downloads/documentToDownload.doc">Click here to download file!</a>

Clicking this in your page instead of linking to a page will simply start downloading the file in your browser - easy!

Comments

Popular posts from this blog

Android: Programmatically get list of installed apps on an Android device

Integrating Google Analytics into existing Android app

Update eclipse Android Development Toolkit to version 23.0.0