Hi there pps

I sincerely hope one of you boffins can help me. I am sure it's quite easy to do, but I am relatively new to web designing.

My question: What html code can I use - when somebody clicks on an image link, it doesnt open the image, but it DOWLOADS to the person's chosen directory?

If it will help - I am using Dreamweaver CS4/3

Thanks,

You don't. The user does this.

The user right-clicks on the image, and selects Save Image As from the menu.

It would be a security violation if a web page did this on its own.

Hi, I dont think it would be a security violation if you create a link to download an image. I am just trying to move away from having to write on the webpage 'Right click on link and select "save target as"' - it doesnt look nice, and I dont have the space on the page.

in html I dunno
in php I use a link to a force download script <a href=download.php?file=filename&type=filetype> it does not check for filetypes etc, because i code the link

<?php if(!$file) return false;
header("content-disposition: attachment; filename=$file");
header("content-type: $type;");
readfile("$file"); ?>

there might be need to sanitize the code to prevent someone getting other files off your site http://www.yoursite.com/download.php%3Ffile%3Ddownload.php%26type%3Dtext%2Fphp works

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.