Link for File Download

Hi Experts,

If I have a file at
www.domain.com/downloads/myfile.xlsx

which is at
C:\inetpub\wwwroot\domain.com/downloads/myfile.xlsx

My question is, from  domain.com/mod/index.php, how would I write my <a> tag to engage download?

I have <a href="../downloads/myfile.xlsx" target="_blank">, but I am getting Permission Denied.

Thank you

Edit: This may be a Windows Question.
APD TorontoSoftware DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CompProbSolvCommented:
What sort of permissions do you allow for that file or folder to the type of user that is trying to access it?
What do you get if you browse to www.domain.com/downloads?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
APD TorontoSoftware DeveloperAuthor Commented:
I just need to bring up the Save As window for the user, as you see in any other site.  Example, clicking on a pdf link
0
APD TorontoSoftware DeveloperAuthor Commented:
Here's a test
test.txt
0
Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

APD TorontoSoftware DeveloperAuthor Commented:
Clicking on the  file, opens it
0
Julian HansenCommented:
My question is, from  domain.com/mod/index.php, how would I write my <a> tag to engage download?
You don't write the <a> tag from the perspective of index.php you do it from the perspective of the browser so

<a href="http://www.domain.com/downloads/myfile.xlsx">Download File</a>

Open in new window

0
APD TorontoSoftware DeveloperAuthor Commented:
That too gives me Access Denied, so does manually pasting this in the url
file:///C:/inetpub/wwwroot\domain.com\downloads\myfile.xlsx

I just tried giving Full Permissions to IIS_IUSRS for C:/inetpub/wwwroot\domain.com\downloads\ and all child objects, and I get


An error occurred while applying security information to:

C:/inetpub/wwwroot\domain.com\downloads\myfile.xlsx

Access is denied.

I'm using Win 7x 64 Pro, and yes I'm logged in as Admin.

I'll also add Windows to this Question's categories.
0
Julian HansenCommented:
Hang on, I thought in your OP you said the document can be accessed like this

www.domain.com/downloads/myfile.xlsx

If you put that in your browser does it work?

If you get access denied then you need to look at the permissions on the folder and make sure you have the right permissions to access the file.

file://c:.... is pointless as this is only accessible on the machine where the file resides.

Step 1.
Can you access the file in the browser like this
www.domain.com/downloads/myfile.xlsx

Yes - then it will work from the page

No - check the permissions on the folder and alter until Step 1 above gives you access to the file.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.