Can I create a directory in client PC? - javascript

I have multiple questions
Can we create a directory in client machine ?
Can we check the running browser's default download path?
My requirement is that the user will download a BLOB data from my DB that time I want to create a folder in client machine and use that folder to save the blob data.
Can this be done using javascript,jquery,ajax,php,angularjs ?

You can't create a folder in client PC using JS.(don't even bother looking with HTML and CSS)
The best way you could accomplish something as you describe is to give a .zip to your client, so while extracting it, it creates his own container (the folder). But you must be sure that the people who intend using your web application knows how a .zip works.

Using PHP you can't do anything in the client PC. PHP is a server side programming language. So, it is running only in the server. When you make any request to the server then only PHP performs. In the browser end or client side only HTML, CSS and JS works.

Related

Getting a Python server to execute a script

I'm pretty new to web development, so bear with me if these questions seem pretty fundamental.
My use-case is as follows: I am hosting a server using ngrok which allows me to allow clients to securely tunnel to a server I host locally, using a public http(s) URL that ngrok generates.
Currently the server I am running locally is the simplest possible python web server (I literally just invoke 'python -m SimpleHTTPServer 8080').
Let's say I have a file "simplescript" located in the local directory where I instantiate the Python server. I would like to put in php code in "simplescript" so that when somebody fetches the file by using the browser to access "https://ngrokURL.ngrok.io/simplescript", then my server will execute the php code in the script directly and return the return value (if one is generated) to the client requesting my file.
Right now, when I try to do this, the client accessing my file only receives the actual text content of the script, and so it seems that the script is not being executed at all.
Question:
Is my use-case something that can be achieved using the Python simple HTTPserver, or do I need other tools?
How can I make my scripts executable for my server (if that is something I have to do)?
Thanks for the help!

Read remote directory with client-side javascript?

I'd like to scan a directory on my server, using JS, and create a link to the most recent file in the dir.
My server doesn't disallow directory listings; I can see the contents of the folder if I navigate to it.
Is it possible to do this in straight JS?
All Javascript can do is HTTP requests and read whatever your server responds with. If your server doesn't give you any sort of directory listing over HTTP, then there's very little you can do with Javascript. If it does give you a directory listing you could try to parse it, but you still can't create any files or links on the server purely with client-side Javascript. This really calls for a server-side solution (PHP, Python, Ruby, C#, shell scripts; whatever you're comfortable writing).

Upload files from mobile on server using jquery

I have a mobile application which needs the user to attach some files from his mobile and upload it on the server.
Is there a way to upload files on the server from mobile using JQUERY/JAVASCRIPT ?
I found many doin it with PHP/ASP.NET-c#...but my need is HTML with JAVASCRIPT/JQUERY...!!
FURTHER INFO ON MY APP (Kindly neglect it if not needed):
I have my front-end in HTML/CSS..I have a WCF service running on my server that does the communication with the database..I use the WCF service by making ajax calls from my client side..
I achieved all the other operations such as insert/delete/update/retrieve data from DB using these services only..
I was wondering if there is any possibility to do the "upload files on the server" task also using these webservices...but didnt get any idea about it !!!
Here is another question exactly precise to my need !! File upload service using WCF along with jquery(AJAX) and html client
Sorry if i m wrong anywhere..This stuff is totally new to me and so i need all your guidance..
To save an uploaded file, you need an server side script (PHP, ASP e.g.) to move the uploaded file from the servers tmp directory, to your desired location.
Maybe can you edit your serves configuration so it writes the uploaded files automatic to your desired location, but I wouldn't suggest that due to security reasons.
Is this a native application? If it's just a website then you'll struggle as safari on iPhone doesn't support file uploads. If it's a phonegap application you could maybe hook into the file API...
Ok some of the points worth mentioning.
When you wanted to upload file to server you have to POST file with multipart content type of the form. For this you might need to write WCF service on server end accordingly. I am not having good experience of WCF but this post should help may be
<form method="POST" enctype="multipart/form-data" >
HTML5 file API and XHR Level 2 specification you can upload files to server. As they are new features and JS and DOM involved yes you can consum and do it in JQuery as well as long as your browser is supporting them.
With these things i am not sure if there should be any issue while uploading files to the server.

Audio fingerprinting in javascript

I am trying to compare audio files at client side, I will not upload them on to the server, hence I want to get the fingerprint of the file even before uploading it to the server.
Do we have a library which can be hosted on our website
If No, Is it possible to do one , I am planning to
I have a song read from local system , I want to get its audio fingerprint so that I can compare with other audio file either on the server side or client side . I can send it to the server and get it done by methods already available in java or c# , but thats too much load to the bandwidth. So I wish to get the audio fingerprint at the client side itself using javascript .
I'm not exactly sure what you mean by "fingerprint" but if you just want to get metadata information you can check out this library: https://github.com/aadsm/JavaScript-ID3-Reader
I would recommend echoprint as it seems to be what your looking for.

How to ftp a file over to a server from PhoneGap/webapp?

Is it possible to connect to a server and FTP a file from within PhoneGap application? Basically I suppose - is there a way to open an FTP connection with Ajax/JQuery somehow?
I don't think you will be able to FTP a file from PhoneGap however they do provide an API for transferring a file to a server using HTTP multipart encoding:
http://docs.phonegap.com/en/1.0.0/phonegap_file_file.md.html#FileTransfer
You would need a script on the server in your chosen technology to receive the file however you should then be able to do whatever you like with it, including move it to the directory you are trying to FTP to
Ftp program for phone gap is here please see this bellow link.
https://github.com/macdonst/FtpClient

Categories

Resources