Early last year, I created a website that parses a CSV file and parses / displays it in a certain way for internal use. One page of this website provides an upload / download function so that the CSV file can simply be updated from the front end. This part has worked fine up until today. I must have changed something while working that has affected the download but for the life of me I can't think what.
I use a PHP copy function to get the file from a form and upload it to the server. This works fine, I can select a new CSV file on the front end web page I've created and it uploads fine. I then go to CPanel file manager, double check the file and I know it's the same new file that I've just uploaded due to changes I've made. When the PHP functions uploads it, it renames it with a certain name overwrites the old version. So to download it, the front end web page has a simple static link to the CSV file.
Now get this: since some point today, whenever I click that link, it downloads the old version of the file. I've rechecked everything I can think of literally about 25 times:
- The website domain is an addon domain, the DNS is all correct.
- The addon settings in CPanel still point to the folder that I'm using.
- The link on the web page is absolutely correct, and is the same when I inspect the HTML code.
- I've turned off caching in
.htaccess
, cleared my cookies for this site. - I tried deleting the CSV file altogether.
- I've tried opening in incognito window
However, despite any and all of these, it still downloads the old file, and when I check CPanel the new file is there with the new details and the old one doesn't exist.
I thought I'd be clever: in CPanel I copied the file and renamed it: I tried to download it using the same style of link (just renamed) and but instead this takes me to the root web page of the site although I have no redirects set up.
I am completely stumped. I have rechecked multiple times that the link is correct, that I'm looking at the right file directory, that everything matches up. And it does. Just that somewhere, somehow, the wrong file is being downloaded and I have no idea where it's coming from.
wget
orcurl
? – Stephen Ostermiller♦ Mar 31 '20 at 14:52wget https://example.com/file
while curl prints to the terminal by default but can be directed to a filecurl -s https://example.com/file > file.csv
. Curl can do nifty stuff like examining headers:curl --head https://example.com/file
– Stephen Ostermiller♦ Mar 31 '20 at 15:50