javascript create link to directory - javascript

I am running a webserver on linux Centos7. It is located at local IP address 192.168.1.100.
Further, I have a Windows server running on the same network, at local IP address 192.168.1.200.
I need my users to be able to create a directory on the Windows server via the webpages on my webserver.
However, because the webserver is linux OS, it cannot(?) create a folder directory on the windows server, despite adding ALL read/write permissions on the Windows server.
For example, on the click of a JS button on the webpage, I would want php to mkdir at 192.168.1.100/thisdirectory.
Is there a way in php to do this? Do I need to mount the windows drive on the linux server, and then use php to mkdir to the symbolic link?
I am currently using javascript & ActiveX to use the client's machine to create the windows directory - but this is not ideal.
Any thoughts on how best to do this?
Thanks,
Mat

Related

Downloading text file using curl in HTML

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).

How can I run my React project on another machine?

I am having a React project in WebStorm in my machine. I want to run it from another machine. I don't want to transfer the project file as it will cause dependency problems (dependencies which are installed in my machine in WebStorm). I want to have something like a build file which can run on another pc.
How can I do it?
Let the machine you wish to use connect with your machine with code in local network.
Open the Run/Debug Configurations dialog. Enter JavaScript Debug. Click "Share" to switch on the share function.
Get the url that you debug on your machine. like
localhost:63342/cocos2d-html5-v2.2.3/myproject/index.html
replace 'localhost' by your local network ip address. like
192.168.199.160:63342/cocos2d-html5-v2.2.3/myproject/index.html
use the url above to access to your project.

Simplest Way To Deploy Javascript Application On Linux

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

How to browse directory server machine instead of local machine

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.

Is it possible to load one particular file from localhost?

In my application statics files are loading from proxy server I want to load one JS file from my localhost so that I can edit and test it with my production app.
For example:-
www.staticserver.com/39349/file.js
localhost/xyz/file.js
can I do it in /etc/hosts file or any browser plug-in ?
To do this do you need a local http server running in your machine test :-)
Search and install Wamp Server if are trying to do this in windows, if are in linux, install Apache server

Categories