Saturday 14 July 2012

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!

No comments:

Post a Comment

Note: only a member of this blog may post a comment.

Covid-19 impact on mobile applications - a quick case study

Amidst everything that's been going on over the last few months, checking on how my apps have been doing has been low down my priorities...