emeraldhieu
emeraldhieu

Reputation: 9439

Download link to /var/[myProject]/www/[myFolder]/[myFile]

How to create a download link to /var/[myProject]/www/[myFolder]/[myFile] using < a > tag? Click it and download it.

Use this

$zipPath = "/var/[projectName]/www/html/zip_download/Input.csv.zip";
...
<a href="<?php echo $bag->get("zipPath", ""); ?>"><?php echo $bag->get("zipFileName", ""); ?></a>

When click it, it unexpectedly goes to: http://[hostName]/var/[projectName]/www/html/zip_download/Input.csv.zip

Upvotes: 0

Views: 229

Answers (1)

Vineet1982
Vineet1982

Reputation: 7918

Why you are adding:

/var/[projectName]/www/

Just remove that it will run correctly. As adding /var/[projectName]/www/ means the folder is from

http://[hostName]/var/[projectName]/www/html/zip_download/Input.csv.zip

as WWW is website root and thus removing will get the properly working

http://[hostName]/html/zip_download/Input.csv.zip

Upvotes: 1

Related Questions