WebSite - download link - html

I'm just playing around with HTML, and wanted to create a link to access a file in a particular location on the disk (not on the disk where the source code of the web page is located).
I have tried to do the following:
Download My File
but this cannot access the file and gives an error.
What can be the problem, and how do I fix it?
Thanks!

This should work! Just add file:/// in the link URL
Download My File
This will only work if you run the Application offline.

There is no way you can do this with pure html. You will need to use a dynamic web technology such as php or Asp.net.
Can you imagine the security issues if you could download any file you wanted off the web server just by changing path of that link?

Related

my wepApi giving error when I try open my psd html file

I Have wepApi project but I want to use it with adobe photoshop.So I design to web site with adobe and after I convert to html file.But When I try to open it with localhost it's giving me error.But it's working on live server.
enter image description here
I never used before abode but I have to for one project.So maybe someone know what is the solution?
There are several potential causes for this problem. Here are a few potential answers:
Ensure that your local machine is running a web server. The HTML file won't be able to connect to your API without a web server.
Ensure that the URL you are using to access the HTML file is correct. The format should be "http://localhost/path/to/file.html."
Make sure your web server is operational and properly configured if you use one.
Make sure your HTML file is free of syntax mistakes. To check for issues, you can use a tool like the W3C Markup Validation Service.
I hope this is useful.

Download attribute opens file instead of downloading

I want to test downloading a local file using the <a> tag in HTML. The attached code doesn't seem to download the file, instead, it opens it.
<p>Interested? Download <a href="download_files/ChannelLogo.png" download>here</a></p>
Your code is correct, however, the download attribute only works when you are viewing the code from a server, due to the same-origin policy of most browsers.
Are you previewing the file by double-clicking the file or directly opening it up in a browser? If the URL while previewing starts with something similar to file://FILEPATH_HERE or /Users/FILEPATH_HERE, you are opening the file rather than serving the file. If so, you should run your code from within a localhost setup to test. That may involve running a server locally, or using an editor extension to spin up a project-based server. Once your URL starts with http:// or https:// the download will work as intended.
Alternatively, you could upload the project somewhere on the web.
It depends on where the file is located and how files are being served.
Either way, whether it is a plain static website with local files or being served by a server, you might need to check the href again to make sure it is correct.
Could be something small like /download_files/ChannelLogo.png instead of download_files/ChannelLogo.png.
Edit after question update:
Yes answer by Riley is right: it will only download if you are using a server. You could use a server like Node.js to run and test what you would like to do.
Otherwise you could look into Electron if you would like to work with the filesystem more directly, all depending on what it is you would like to do with your program.

Files not showing in htdocs

When creating a new database through PHPMyAdmin and trying to access localhost/newdatabase, I get this message:
"Object not found! The requested URL was not found on this server. If
you entered the URL manually please check your spelling and try again.
If you think this is a server error, please contact the webmaster.
Error 404 localhost Apache/2.4.34 (Win32) OpenSSL/1.1.0i PHP/7.2.9"
The file doesn't show in xampp/htdocs either, only in xampp/mysql/data.
If i create files directly in htdocs, they work perfectly on localhost/.
Why has the file not been created in htdocs?
The content of the htdocs folder are files that can be interpreted by the browser such as HTML5, CSS, JS, etc... in order to show a webpage along with it's funcionality to whoever accesses it. A database in the other hand can't directly be opened by a browser, but rather accessed within the server by a backend language like PHP, in order to get the information that can be stored in it through tables. You seem to be new to web programming, so I'd recommend to quickly google some beginner tutorials that can help you to understand the most important concepts. To take on from your kind of confusion, I'd point you to expand your knowledge on these concepts:
HTML5
CSS
PHP
MySQL
Once you get the grasp of them and identify each by their core funcionality, you'll be good on your way to make webpages. Later on you'll find yourself with demands like making your webpage look nice and clear, and also to make it load fast, but there's time for everything and the concepts I pointed are the best start for you.
if you wanna open your database URL = http://localhost/phpmyadmin/
File directory ~ xampp/htdocs for source code such as extension file .php .html .js or other.
if you wanna load localhost a URL is http://localhost:80 (auto find index file to first load)
Sample given as image folder for my code. Hope that can help you to understand xampp

Wordpress create widget with link to local file

Hi i´m trying to use the text widget to put a link to local file, but dint work, and I dont know why:
I use this:
Drive C
but if I link to real url it works fine:
Google
If by local you mean it is still on your laptop, you will need to upload the file to your WordPress installation's media folder before using it on the site.
The images should be acsessable to the sever hosting the site, either because it is stored directly by the server, or because it is can be acsessed over the Internet.
If by local you mean it is still on your laptop, you will need to upload the file to your WordPress installation's media folder before using on the site.
Due to your response about it being on the client's device I Think they have to upload the file before the server can work with it.

HTML - How to run a file from the user pc?

I'm creating a little project in HTML and there's something that I would like to do.
Imagine that my HTML page is hosted, and you can download there some .ppt and .exe files and place to a specific folder.
Now, that's the problem. Considering that the files are in the right folder, I would like to run these files when the user select their respective options at the HTML page.
Does anyone know how to do it? Thanks :)
This isn't directly possible, for security reasons.
If you control that application or can install something on the user's system, you can associate a file type or URI handler with the application you wish to launch.