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 TorontoAsked:
Who is Participating?
 
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
 
APD TorontoAuthor 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 TorontoAuthor Commented:
Here's a test
test.txt
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

 
APD TorontoAuthor 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 TorontoAuthor 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.