How to create download file

You can choose any file from your web hosting server to make it downloadable.

First, upload the file on the server. You can put that file anywhere you want in the root folder. You can create a separate folder to add the file.

Upload the pdf, jpg, zip etc file on your server. Then take the path name of the file. The path-name is the file location on your website. e.g.

www.yourdomain.com/abc/my.pdf

Check this path by browsing the page directly in the web browser. You can see the file.

If there is an error then you might have selected the wrong path. Check the path again. Most mistakes are space or hyphen between the file name. so the solution removes all the space and hyphen from the file name to make it easy to read.

Now it is time to create download link by using HTML tags.

Add below HTML tag in your Html.

<a href=”http://www.yourdomain.com/abc/my.pdf” download>
<img border=”0″ src=”/images/downloadimage.jpg” alt=”mddir” width=”104″ height=”142″>
</a>

The HTML will create a download link. Below are the things that you need to take care of.

– download – The word “download” in the href tag instruct browser to attempt download action when someone clicks on the download image.

– img – The image tag declares the image path. In this case, it will be your download button. You have to upload this download button image on your server. Then take the path / URL of the file and add that in “src” tag.

– Width & Heights – The width and heights are CSS element to make your download button look small or big. Change the figures as per your requirement.

Now try yourself and let us know your comment.

Related Posts

Leave a Reply