how to include a download button in my page that downloads a text file locate in the site files

hi, hi
I would like to know how to create a button or a link that downloads the text file that is located in a file in the folder of the site, even pointing several times the path or with other technique it tells me error 404 that it does not find the folder
I do not want to put the address of my site for personal reasons

Welcome to the forum, Wordcraft.

Without a URL it is hard for us to help you.

Have you double-checked that the folder exists on your website?

7 Likes

Please give us your site’s url so we can help you way, way more effectively.

Try clearing your cache, and making sure that the link and file name are the same. Remember, capitalization matters!

7 Likes

ok i will give you the website url here : archiveconv1ereb.infinityfreeapp.com/accueil.html

Thank you.

If I understand it correctly, the “Archive du Lundi” file should be downloadable, right?

If so, I think this is what you’re looking for:

7 Likes

I think you don’t understand I made this line but clicking on the link it sends me to infinity free’s 404 error page as if it doesn’t find the targeted file. Maybe I misplaced it in the files for ca I made expres to create another folder for good separe everything I put it outside the htdocs file it is maybe because ca but I do not know how to point the file out correctly. Because if you look well I did the same as the page you put!

Does the folder stockagearchive exist in your htdocs folder with the file archive1.tkt in it? Can you share a screenshot of your file manager?

5 Likes

I think I made a mistake actually I put my archive storage folder outside of the htdocs file it’s maybe for what it doesn’t work and yes i can give you 2/3 screenshots

Yes, your website cannot access files outside of the htdocs directory. You’ll need to move stockagearchive inside htdocs for your website to work properly.

4 Likes

I removed your first and last image as they contained the filemanager URL, which contains your hosting account password.

I recommend you change your hosting account password via the client area just to prevent anyone who might have seen your password from using it.

8 Likes

thank you … i don’t see the password in the link thanks

I listened to you but unfortunately to have changed place it does not find the file. if you want here my code

For me, the link goes to archive1.html, not archive1.txt. And that URL just works for me.

Please try to check the page in Incognito Mode in your browser. It’s possible that either the wrong link or the error is cached by your browser, which is why your changes don’t appear to be working for you.

5 Likes

yes precisely it is on this page that it sends and on this page the I would like the link on the second page download the file

That’s because, in your code, you are linking to:
https://archiveconv1ereb.infinityfreeapp.com/stockagearchive/archive1.tkt

When the URL needs to be:
https://archiveconv1ereb.infinityfreeapp.com/stockagearchive/archive1.txt

You’ve made a typo in the file extension and wrote tkt instead of txt, fixing that should make your file display. As for forcing the download, you can refer to the guide Admin linked you to:

Your final HTML code for the link would be:

<a class="lienTelechargement" href="stockagearchive/archive1.txt" download>Archive1 27/11/2023</a>
6 Likes

ok it works thanks now it’s a bonus but now how to protect it with a password? 'Cause I can’t figure out how to do it on the internet or anything

You can use the “Protected Directories” tool in your client area to protect the stockagearchive folder with a password, so when anyone tries to access a file in it they will be met with a login box.

5 Likes

thank you thank you … I don’t know how to thank you thanks to this my friends and I can use the site in a time reccord really thank you

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.