I have two servers: Server 1 and Server 2
My application is installed on Server 1. Server 2 contains some .PDF files.
I have created a Shared Drive.
Via UNC path, I am able to open PDF files folder from Server 1 as below:
\\Server2\Files\a.pdf
This UNC path I want to use when I want to open PDF files in a new browser window using javascript.
I tried using:
window.open("\\Server2\Files\a.pdf")
this is not working.
I also tried:
window.open("file://Server2/Files/a.pdf")
this is also not opening file nor giving error.
How to use UNC path to open file from Server 2?
Related
I am trying to download text file from server to local directory.
If I execute following curl command it copies myfile.txt from server and saves in same directory as newfile.txt.:
curl -o newfile.txt http://myserverip/myfile.txt
I want to automate this by running the command from javascript while loading the webpage.
For example if I open an html page (which runs a javascript) like http://myserverip/getnewfile.html in the browser the myfile.txt from the server should be copied to newfile.txt in the loacl directory.
Can anyone help me to write javascript to execute the curl command?
Please note that the server in local area network and router is configured to allow connections only from white-listed mac ids of local machines so there is no any authentication required to connect to server.
You can't run local command-line commands from JavaScript, because that would be a massive security vulnerability. The tool you want to use for this is either window.open (to open a tab with the file in order to cause the browser to download it) or the fetch API (to retrieve the file for use in JavaScript).
I'm trying to view a web directory. It only works when I enter "folder/images/cat.png", if I enter "folder/images/" it gives me:
403 Forbidden nginx/1.11.8
How can I download or see all the files within the folder directory without having to go directly to the image included at the end of the directory website link? (Such as "folder/images/cat.png")
Add this to your nginx config file:
location /path-to-folder {
autoindex on;
}
Make sure there's no index file in the folder you want to view already e.g. index.html/php.
You'll need to have HttpAutoindexModule enabled.
You can also do this on Apache web servers by putting an .htaccess file in the directory you want to view:
Options +Indexes
I have an folder say 'mywebapp' on windows machines. This folder has index.html page, js directory with java script files and css directory with css files.
Now when i open this index.html into browser, the browser displays contents pretty well, as if i have deployed this application on server, which is not the case.
Now i wanted to do same on my Linux machine vm, login-ed through putty. I tried using pythons SimpleHTTPServer which gave me same result. But as soon as i exit from putty session, the webpage doesnt display. seems like SimpleHTTPServer server connection is broken once i exit the putty session.
Please help me.
Or any other professional and easy way to get my webpage displayed. Tomcat seems good option but i don't have root permission and don't want hectic deployment process.
I heard about node.js, but i don't have root permission to install node.
Most simplest way i can suggest it to download and copy tar.gz file from location:
https://tomcat.apache.org/download-70.cgi
1 then gunzip and untar this downloaded file.
2 Go to conf/Catelina/localhost folder.
3 create an xml with your application name, e.g. mywebapp.xml
and put following to this file:
<Context path="/mywebapp" reloadable="false" docBase="<root-path of your application folder>"/>
here "root-path of your application folder" will be the root folder of ypur HTML, js and css files.
Then just start this tomcat using /bin/startup.sh command and check on browser using localhost:8080/mywebapp
I have a project which requires me to upload an excel file , manipulate it and then give the option to download the modified file.
I have successfully uploaded the file on my local machine but after manipulating and giving the option to download by Download the download says "No file found" . How can i make this file available to the project ?
`
The path "/home/aman/..." (a unix user directory) is not accessible from the net (or at least I hope so). You can create a different directory to store your downloads, maybe "/var/downloads", give Tomcat rights to read it, and add an external context to your server.xml (between the "host" element):
<host ...>
<Context docBase="/var/downloads" path="/downloads" />
</host>
Then you should be able to access:
http://yourdomain.org/downloads/a.xls
Scenario:
1.My web application is hosted in the following IP (13.67.3.12).
2.We have 'Browse' option for selecting the file. If I open the browser window from the client machine (13.67.3.21) it is showing local machine directory instead of it should open server (13.67.3.12) machine folder directory. Is it possible in web application?
Is there any way to do it using javascript/jquery/node.js/anytools?
One way to do it is to create a shared folder on the server, then assign permissions to the share based on either a active directory service account, or user group. In the file dialog options, you can set the start directory of the dialog. You can set this to default to the shared folder location.