1

I keep getting a 404 error saying the file is not on the web server, trying to create an href link to download an excel file.

<p><a href="/ExcelFile.xlsx" download> Click to Download </a></p>

The excel file is in the same directory as the page this is being worked on currently, so there is no file path, I have tried a file path but it gives the same error.

user20929302
  • 343
  • 1
  • 4
  • 14

2 Answers2

2

Just had to add a folder for files and it worked.

Original:

<p><a href="/ExcelFile.xlsx" download> Click to Download </a></p>

Working:

<p><a href="TestFile/ExcelFile.xlsx" download> Click to Download </a></p>
user20929302
  • 343
  • 1
  • 4
  • 14
1

You are saying that ExcelFile.xlxs is in the root folder of the web server / virtualhost.

So if you have a structure where /www is your top level folder, than ExcelFile.xlxs need to be directly in /www and not in a subfolder.

Take a look at absolute and relative paths, this will explain this behavior.