How to download a file on clicking the name of file using PHP?

前端 未结 3 1192
不思量自难忘°
不思量自难忘° 2020-12-02 01:02

I Have a list of information in which there is a field where name of file is hyperlinked. I want the user to download that particular file when he clicks on it.

so,

3条回答
  •  甜味超标
    2020-12-02 01:19

    You don't need AJAX for that, you cannot even do what you want using AJAX. If you want to obfuscate URL to a file, then replace your download function with this:

    function download(path,val) {
        window.location.href = path+"download.php?val="+val;
    };
    

提交回复
热议问题