Choosing destination folder for FTP download. (HTML, jQuery or PHP) - javascript

I have written a script in PHP that connects to my FTP server and downloads the latest backup of all the websites I have created.
I have written this script in PHP (using ftp_get and all those lovely functions!), but I have also created a nice looking dashboard in HTML, which uses AJAX to not only execute the PHP code but to output all the "echo"'s into a textarea so I know which ones were successfully downloaded and which ones failed.
My problem is that I am not the only employee, there are quite a few of us who could execute this script, so on the dashboard I want there to be a way of choosing where these backsup are saved without having to edit a hardcoded destination in the PHP. At the moment, it's hardcoded to save to my desktop, but if someone else were to use it on their computer, it won't work.
I have tried searching for this, but no one has asked exactly the question I needed answering.
If the answers could be using HTML, JavaScript/jQuery or PHP, that would be handy.
Thank you in advance.
------------EDIT------------
Not sure people are understanding my problem, so I will try and explain it differently :)
I have a backup tool that will connect to an FTP server, go through each project folder and download the latest backup of that site. In total, there are at least 20 files to be downloaded.
Multiple people will be using this tool, depending who is around to backup the files.
Bob might want to save it directly to his desktop: C:/Users/Bob/Desktop.
Barbara might want to save it in C:/Users/Barbara/Backup Folder/2017/
Jimmy wants to save it in C:/Users/Jimmy/Projects/Project_name/Backup-01-01-2017
And I might want to save it onto an external HDD.
I want the tool to have a function that will allow the user to specify a location on their HDD where these files will all be saved.
I hope this is clearer.
Many thanks.

Related

How do I save data, that would normally be in a database, to a SharePoint folder or the site's root folder

I'm working on a project for my employer that is off-job-description for me. I am not in my department's IT/WebDev departments. That being said, my department is trying to streamline a process that is horribly done right now. Here's what I'm trying to do..
I want a form that can be submitted on a local computer (no PHP library at this time - ticket opened with IT for months now). It will then be used to populate a calendar (which I have no issue programming and filling automatically with PHP normally, but like I said - no library).
Basically - I need to be able to save the input data locally on a SharePoint folder and be able to "grab" that data when the site is loaded.
Again, I have no problem with the display/structure parts - I just need to know a good way to save/load the data (long term) until my IT gets its... stuff... together and get's me a php library and SQL Database.
I'm not looking for any type of script help or anything. I can learn what I need. I just need ideas of what type of function or something I can use. If you have a website with some tutorials or at least documentation for it, I'm happy to read up myself.
Browsers cannot access your local filesystem and are heavily sandboxed to protect you and your data from nefarious websites (even if you have written them).
As such, your only option of writing data to a Sharepoint folder is to leverage a server of some kind. This can be created locally on your own PC, or on a spare one for the time being.
You might to need to contact your IT admin, so that they can grant you access to your Sharepoint, so that your PHP code can read/write to your Sharepoint folder(s).
Good luck!

Automatically create a CSV file with Javascript data on Github

I'm working on a Quizz with Html/JS on Github and which will be dedicated to my comrades.
I would like to be able to read everyone’s answers so I thought about creating a text or csv file with their answers that would be saved in a specific directory of the github project.
But I’m a beginner and I don’t know if that’s possible, i’ve seen tracks that use PHP or NodeJs with FileSaver.js, but I haven’t managed any of them because i would like it to be automatic, not to ask the user to download his answers.
If some people knwo how to do it or explain me why it’s impossible and how to do it otherwise it’ll be cool.
Thanks ! ;)
Unless you want to make every person using the quiz a contributor to your Github project (which will require that they sign up for Github accounts and tell you their account name so you can manually grant them permission) and then use the API to read the CSV file, modify it, then commit the change (and resolve any merge conflicts caused by race conditions): This is not possible (and if you are willing to do that, then it is among the most complex approach that you could take).
If you want to store and aggregate data submitted by visitors to a website then write some server-side code (using whatever language and frameworks you like, PHP and Node.js are both options) and use a web hosting service designed to support them. Github Pages is designed only for static pages and doesn't support any form of server-side programming.
Once you store the data in a file, just use git commands to commit and push it.

Uploading a file from client to server in python bokeh

We have set up a bokeh server in our institute, which works properly. We also have a python-based code to analyse fMRI data which at the moment uses matplotlib to plot and save. But I want to transfer the code to bokeh server and allow everybody to upload files into the server from the client and when the analysis is done in the server, save the output plots in their local HDD. This transfer file procedure seems to be lacking in bokeh atm. I saw a new feature recently added in github to upload json files, but my problem is fMRI files come in various formats, and asking (not necessarily tech-savvy) users to convert the files into a certain format beats the purpose. Also, I do not know any JS or the like, hence I do not know what solutions people usually use for such web-based applications.
If anybody has any solutions to get around this issue, it'd be happy to hear it. Even if it is a solution independent of bokeh (which would mean users need to open a separate page to upload the files, a page to run the analysis, and a page to save the output) please let me know. It won't be ideal, but at least better than no solution, which is the case in bokeh right now. Thanks!
I'm not sure where you are getting your information. The FileInput widget added in Bokeh 1.3.0 can upload any file the user chooses, not just JSON.

Is there any way to edit a local file through a web page without running server software?

I've a web working on a web page that's basically just a big table of links. I use javascript to read from a text file, parse it, and create a table based on that.
I'd like to be able to have a button on the page to add new a row of links and add them to the text file (or another file type if it's better).
I know you can accomplish this with php, node.js, and others, but all the methods I've found require server software to be running. Is there any way around this? For example, is there a way to use javascript to call a python script, or any other way?
The page is just for personal use, so I'd like to avoid running server software just to use it if possible. I know you can set it to download a text file, and you can save it in the same location, but I'd also like to avoid that.
From the research I've done, it doesn't seem possible, but I just thought I'd ask before I give up. Thanks in advance.
You can only read from files locally in browser with javascript.
This would be a huge security vulnerability if scripts in browsers could write files to your machine.

javascript autocomplete with source being names of files from a directory

I have spent a considerable amount of time googling this and was hoping someone on here had a reference or starting point I could expound upon.
I am looking for a javascript/jquery AutoComplete script which has the source being the file Names inside of a directory. I welcome any suggestions... thanks!
If worse comes to worse, I can just use an AutoComplete script (jqueryui or typahead.js) which has a source file for the results, but then I would have to code a separate function to automatically write to that file each time a new file is put into the directory or is deleted from it, and I am just trying to avoid that should something already exists.
EDIT server side scripting is unfortunately not an option for me. This is being run through an HTML Applications (HTA) file, so fortunately I do have additional freedoms than a typical web application.
I found an article for autocomplete textbox using jsp, jquery has been used but the code is written in such a way the data is retrieved from database and it comes as a suggestion when user types a letter or part of word.
if you are looking for it, you can click it here

Categories