Within my public folder on my node.js server I have a standard html website set up.
Im trying to download files from a webpage using
Download
but i keep getting:
my folder structure looks like this(shortened)
Files
-Solar.zip
public
-project.html
Where project.html is where I have the button to download.Should i be using a get instead? or is it not html related at all?
You need to add full path to zip file in href attribute:
Download
download attribute just allows you to set a separate file download name than the actual link. For example:
Download
will start downloading file a.zip but will rename it to b.zip
Related
I'm using ReactJS to build a site, and I want to create a link (a href="relativepath") to a local HTML file so that when the user clicks on the link, it'll open up the html page. The local file is in a different folder X outside of the project, and I don't want to upload it into my src folder because the html file depends on a lot of other files in X. Is there a good way to do so?
I also want to upload a different local HTML file that is already within the src folder of my React App. I currently have something like this:
import htmlFile from "../links/htmlFile.html"; export default function Something(props) { return (<a href={htmlFile}></a>)}
and it says in my terminal that
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> <html>| | <head> >
I already tried adding in webpack + an htmlLoader, but I think I followed the steps incorrectly as I wasn't able to get it to work. I uninstalled those packages, so I'm now back to square one.
Thank you so much!
Just linking to or importing from a local file in some other location won't work unless those local files are also deployed to the server in the same location relative to the app (and the web server has access to that location).
So you'll need to copy the file and its linked dependencies in a folder that will be deployed along with your react build, but not where it'll get treated as part of the react codebase so webpack will try to compile it (so not in src either).
If you used create-react-app to set up your application, for example, this would be the public folder; other webpack setups may use different names but the general concept is the same.
I have created a html file of my results using .to_html() function.By default the html file saves to the root location of your project folder.But what if i want to save it to the specific location?How to give a path to the created folder .Im using flask to connect python to html.
You can access the root path of the flask through app.root_path.
So let's say your folder name is myHtmlFiles. So we can save the files like below:
file.save(os.path.join(app.root_path, "myHtmlFiles", "hey.html"))
You can also take a look at app.config, you can put your folder path here and use it anywhere in the aplplication.
<%
out.print("<a href='file:///D:\\helloitext1.pdf'>"+"BIO DATA"+"</a>");
%>
I have a file name helloitext1.pdf in D drive and i want that when click on
the link bio data my file gets open i know i am lacking somewhere.
Tools which I am using are Eclipse and apache tomcat(localhost).
The file get open when i have paste the file in eclipse directory but i
want to open the file by clicking on the link Bio data from my D drive .
Any help would be appreciated.
To Access Local Files or Static Content (Images, Videos, Media or any other files outside of the Web Application(WAR)) in the System.
Go to TOMCAT_DIRECTORY/conf/server.xml and Add the following content in server.xml
<Context docBase=”D:/foldername/” path=”/files” />
Add all the files you want to access in this folder. Use path ="files/helloitext1.pdf"
Refer this
I am creating a site that allows the person to download the file. The way im doing it now is just uploading the files and folders so if the person wanted something they would go to that folder and download it.
If i wanted to style it like add text how would I do that. If it is done with a html file, i have to create a new .html file for every single file on the server.
If you're running apache, you should configure .htaccess files.
check also this : http://adamwhitcroft.com/apaxy/
I have seen a few examples with link to folder but i realy don't understant what it is or how to manipulate it or get it to set the specific html page within the folder.
My website is a basic one with only CSS and HTML
it is formatted as
[file]home.html // C:/Users/user/Desktop/mywebsite/home.html
[folder]Order // C:/Users/user/Desktop/mywebsite/order/
↳[file]ordersheet.html // C:/Users/user/Desktop/mywebsite/order/ordersheet.html
I want to try set the folder path C:/Users/user/Desktop/mywebsite/order/ as the file ordersheet.html C:/Users/user/Desktop/mywebsite/order/ordersheet.html how can this be done?
To set /order to ordersheet.html change the name of ordersheet.html to index.html
The index.html is the default file that the server will serve to the visitor when he visits that specific directory.
link text
link text = what you want it to say to the user
/Users/user/Desktop/mywebsite/order/ = directory path
Keep in mind that this will only work locally. If you have it up on a server, visitors don't have access to your full C:/ drive so you have to use relative links, i.e. just /order/
If I remebember correctly, you use something like this:
<a href="file:///C:/Users/user/Desktop/mywebsite/order/ordersheet.html>link to file on harddisk</a>
If you would want to have that anchor to a folder, you would just use this:
<a href="file:///C:/Users/user/Desktop/mywebsite/order/>link to a folder on harddisk</a>
Your browser is operating directly on your system's local filesystem, so you can't.
What you have been looking at is a function of a web server (I'll use Apache HTTPD for examples here).
A typical configuration of a web server would map the local part of the URI onto a directory on the local file system and just serve up the files there if they matched the local part of the URI.
If the local part resolves to a directory (rather than a file) then it would look for a file in that directory with a name that matched a list (typically including index.html) and serve up that file.
If none of the files on the list existed, then it would generate an HTML document containing links to all the files in the directory.
Since there is no web server involved when the browser is reading the local file system directly, there is no way to map the directory onto an index file, so you would need to explicitly include the filename in the URI (or switch to using a web server).