Download Image Button
hello to you To be a good coder you need to know a lot.
Today in this post I will tell you how you can add image download button through a tag.
I am working on codeigniter 3. I am fetching data from database and displaying it in a table. This table has a column where the download button is added. By clicking on this download button, the next image will be easily downloaded. If you’re working in codeigniter 3, it’s pretty straightforward. You can use this code in all web development projects.
Let’s see, how if we click on the download button, the image will be downloaded to our computer.
If you notice in the image below, the download button is placed right after the bar code. Whenever you click on this download button, the image will be instantly downloaded to your computer’s hard drive.
As you can see, I ran a loop to get the data into my table from the database.
Notice, I have taken a td and within this td I have taken a tag. See you have given the image path where my image is. And then I have given an attribute called download which is doing the download. The a tag works like a link, but the moment you add the download attribute, the a tag works like a download button. And downloaded the image.
a tag download button
<td>
<a href=”<?php echo base_url().’barcodes/’.$value->product_bar_code;?>.png” download ><i class=”fa fa-download”></i></a>
</td>
At the End
If you using Codeigniter 3 or any other web development language, the process will be the same. Hope this tutorial solution will help you. Thank you so much for your time.
You can find most useful post in below..