0

I have two buttons where, actually, pushing, I can save and then load a static file using:

file_put_contents('results.json', $result);    (Save button)

$arr1= json_decode(file_get_contents('results.json'),true);   (Load button)

Using these commands I save and load a static file, and it is located in the same folder of the original .php.

Now, I would like to choose in which path the file must be saved, choosing for each new file saved, the path and personal file name. I think that I need something similar to the Java language

JFileChooser jc = new JFileChooser(); 

But Now I need it in PHP or Javascript.

Could you help me? Thanks in advance.

  • Are you using php on the command line or in the classical client/server setup? – arkascha Apr 01 '16 at 09:03
  • classical client/server $_POST to pass the data that must be saved. – user6144004 Apr 01 '16 at 09:06
  • Then there is no trivial solution, since for very good reason there is a strict separation here: the server side file system should normally not in any way be exposed to the client side. That is why there is no simply command or extension for the for php. Instead you will ahve to use something like an ajax based file browser solution. Take a look at something like `jquery-filetree`: http://www.abeautifulsite.net/jquery-file-tree/ – arkascha Apr 01 '16 at 09:16

0 Answers0