0

I have a script that allows the download of files the user selects from a specific directory, everything works ok, but pdf files open first then you can download it, I need to force download of the pdf as soon as the link to the file is clicked.

I have included the a href attribute of the script, I tried adding download to the href without success, any help would be greatly appreciated.

<A HREF="'. $_SESSION["dir2"] ."/". $new_array[$i][0] . '">' .  $new_array[$i][0] .  "</A>
saco
  • 21
  • 5

1 Answers1

0

You can use the download attribute:

<a href="'. $_SESSION["dir2"] ."/". $new_array[$i][0] . '" download>' .  $new_array[$i][0] .  "</a>
B3none
  • 385
  • 3
  • 18
jasinth premkumar
  • 1,430
  • 1
  • 12
  • 22